aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/middleware/failsafe.rb5
-rw-r--r--actionpack/test/new_base/render_action_test.rb6
-rw-r--r--actionpack/test/new_base/render_test.rb6
3 files changed, 9 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/failsafe.rb b/actionpack/lib/action_dispatch/middleware/failsafe.rb
index 836098482c..389accbc36 100644
--- a/actionpack/lib/action_dispatch/middleware/failsafe.rb
+++ b/actionpack/lib/action_dispatch/middleware/failsafe.rb
@@ -10,9 +10,8 @@ module ActionDispatch
def call(env)
@app.call(env)
rescue Exception => exception
- # Reraise exception in test environment
- if defined?(Rails) && Rails.env.test?
- raise exception
+ if env["rails.raise_exceptions"]
+ raise
else
failsafe_response(exception)
end
diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb
index f25faee433..96666077d2 100644
--- a/actionpack/test/new_base/render_action_test.rb
+++ b/actionpack/test/new_base/render_action_test.rb
@@ -92,7 +92,7 @@ module RenderAction
test "raises an exception when requesting a layout and none exist" do
assert_raise(ArgumentError, /no default layout for RenderAction::BasicController in/) do
- get "/render_action/basic/hello_world_with_layout"
+ get "/render_action/basic/hello_world_with_layout", {}, "rails.raise_exceptions" => true
end
end
end
@@ -117,7 +117,9 @@ module RenderAction
describe "rendering a normal template with full path with layout => 'greetings'"
test "raises an exception when requesting a layout that does not exist" do
- assert_raise(ActionView::MissingTemplate) { get "/render_action/basic/hello_world_with_custom_layout" }
+ assert_raise(ActionView::MissingTemplate) do
+ get "/render_action/basic/hello_world_with_custom_layout", {}, "rails.raise_exceptions" => true
+ end
end
end
diff --git a/actionpack/test/new_base/render_test.rb b/actionpack/test/new_base/render_test.rb
index b1867fdcc2..16578fbc82 100644
--- a/actionpack/test/new_base/render_test.rb
+++ b/actionpack/test/new_base/render_test.rb
@@ -48,7 +48,7 @@ module Render
test "raises an exception" do
assert_raises(AbstractController::DoubleRenderError) do
- get "/render/double_render"
+ get "/render/double_render", {}, "rails.raise_exceptions" => true
end
end
end
@@ -58,13 +58,13 @@ module Render
test "raises an exception when a method of Object is called" do
assert_raises(AbstractController::ActionNotFound) do
- get "/render/blank_render/clone"
+ get "/render/blank_render/clone", {}, "rails.raise_exceptions" => true
end
end
test "raises an exception when a private method is called" do
assert_raises(AbstractController::ActionNotFound) do
- get "/render/blank_render/secretz"
+ get "/render/blank_render/secretz", {}, "rails.raise_exceptions" => true
end
end
end