forked from eliotsykes/rspec-rails-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_responses.rb
More file actions
20 lines (17 loc) · 748 Bytes
/
error_responses.rb
File metadata and controls
20 lines (17 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module ErrorResponses
# See: https://github.com/rails/rails/pull/11289#issuecomment-118612393
def respond_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
RSpec.configure do |config|
config.include ErrorResponses
end