demarches-normaliennes/spec/support/without_detailed_exceptions.rb

19 lines
752 B
Ruby
Raw Normal View History

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