mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
17 lines
756 B
Ruby
17 lines
756 B
Ruby
# frozen_string_literal: true
|
|
|
|
# https://medium.com/@edgar/rspec-how-to-have-rails-request-specs-handling-errors-like-production-a8c21ed0308a
|
|
module ExceptionHelper
|
|
def rails_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
|