module ShowExceptionsHelper - ShowExceptionsHelper has no descriptive comment
def with_show_exceptions(on_or_off, &block) - ShowExceptionsHelper#with_show_exceptions doesn't depend on instance state (maybe move it to another class?)
begin
env_config = Rails.application.env_config
show_exceptions = env_config['action_dispatch.show_exceptions']
env_config['action_dispatch.show_exceptions'] = on_or_off
yield
ensure
env_config['action_dispatch.show_exceptions'] = show_exceptions
end
end
end
RSpec.configure do |config|
config.include(ShowExceptionsHelper, type: :request)
config.around(:each, type: :request) do |example| -
if example.metadata.key?(:show_exceptions)
with_show_exceptions(example.metadata[:show_exceptions]) do
example.run
end
else
example.run
end
end
end