demarches-normaliennes/spec/support/without_detailed_exceptions.rb
2024-04-11 18:19:30 +02:00

18 lines
752 B
Ruby

module WithoutDetailedExceptions
RSpec.configure do |config|
config.include self, type: :system
end
# Snippet from https://github.com/rspec/rspec-rails/issues/2024
def without_detailed_exceptions
env_config = Rails.application.env_config
original_show_exceptions = env_config['action_dispatch.show_exceptions']
original_show_detailed_exceptions = env_config['action_dispatch.show_detailed_exceptions']
env_config['action_dispatch.show_exceptions'] = true
env_config['action_dispatch.show_detailed_exceptions'] = false
yield
ensure
env_config['action_dispatch.show_exceptions'] = original_show_exceptions
env_config['action_dispatch.show_detailed_exceptions'] = original_show_detailed_exceptions
end
end