diff --git a/actionpack/lib/action_dispatch/middleware/failsafe.rb b/actionpack/lib/action_dispatch/middleware/failsafe.rb index b5a3abcc92..5e0c479fdd 100644 --- a/actionpack/lib/action_dispatch/middleware/failsafe.rb +++ b/actionpack/lib/action_dispatch/middleware/failsafe.rb @@ -11,7 +11,7 @@ module ActionDispatch @app.call(env) rescue Exception => exception # Reraise exception in test environment - if defined?(Rails) && Rails.test? + if defined?(Rails) && Rails.env.test? raise exception else failsafe_response(exception)