Files
manyfold/spec/support/error_handling.rb

17 lines
724 B
Ruby

RSpec.configure do |config|
config.around(:each, type: :request) do |example|
# Make Rails respond to errors like it would in production
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
# Test
example.run
ensure
# Restore config
env_config["action_dispatch.show_exceptions"] = original_show_exceptions
env_config["action_dispatch.show_detailed_exceptions"] = original_show_detailed_exceptions
end
end