From 769f73cc18c58021d49a3b93f1747568fe42ee5c Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Wed, 6 Feb 2019 08:55:23 +0200 Subject: Dispatch actions only if config.consider_all_requests_local is set --- actionpack/test/dispatch/actionable_exceptions_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/actionable_exceptions_test.rb b/actionpack/test/dispatch/actionable_exceptions_test.rb index 46979ed878..ae382e201e 100644 --- a/actionpack/test/dispatch/actionable_exceptions_test.rb +++ b/actionpack/test/dispatch/actionable_exceptions_test.rb @@ -38,6 +38,16 @@ class ActionableExceptionsTest < ActionDispatch::IntegrationTest assert_equal "/", response.headers["Location"] end + test "cannot dispatch errors if not allowed" do + post ActionDispatch::ActionableExceptions.endpoint, params: { + error: ActionError.name, + action: "Successful action", + location: "/", + }, headers: { "action_dispatch.show_exceptions" => false } + + assert_empty Actions + end + test "dispatched action can fail" do assert_raise RuntimeError do post ActionDispatch::ActionableExceptions.endpoint, params: { -- cgit v1.2.3