diff options
Diffstat (limited to 'actionpack/test/dispatch/debug_exceptions_test.rb')
-rw-r--r-- | actionpack/test/dispatch/debug_exceptions_test.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb index b55bd9b204..ea477e8908 100644 --- a/actionpack/test/dispatch/debug_exceptions_test.rb +++ b/actionpack/test/dispatch/debug_exceptions_test.rb @@ -156,7 +156,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest test "rescue with text error for xhr request" do @app = DevelopmentApp - xhr_request_env = {"action_dispatch.show_exceptions" => true, "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest"} + xhr_request_env = { "action_dispatch.show_exceptions" => true, "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest" } get "/", headers: xhr_request_env assert_response 500 @@ -287,7 +287,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest test "does not show filtered parameters" do @app = DevelopmentApp - get "/", params: { "foo"=>"bar" }, headers: { "action_dispatch.show_exceptions" => true, + get "/", params: { "foo" => "bar" }, headers: { "action_dispatch.show_exceptions" => true, "action_dispatch.parameter_filter" => [:foo] } assert_response 500 assert_match(""foo"=>"[FILTERED]"", body) @@ -384,6 +384,23 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest end end + test "logs with non active support loggers" do + @app = DevelopmentApp + io = StringIO.new + logger = Logger.new(io) + + _old, ActionView::Base.logger = ActionView::Base.logger, logger + begin + assert_nothing_raised do + get "/", headers: { "action_dispatch.show_exceptions" => true, "action_dispatch.logger" => logger } + end + ensure + ActionView::Base.logger = _old + end + + assert_match(/puke/, io.rewind && io.read) + end + test "uses backtrace cleaner from env" do @app = DevelopmentApp backtrace_cleaner = ActiveSupport::BacktraceCleaner.new @@ -399,9 +416,9 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest backtrace_cleaner = ActiveSupport::BacktraceCleaner.new backtrace_cleaner.add_silencer { true } - env = {"action_dispatch.show_exceptions" => true, + env = { "action_dispatch.show_exceptions" => true, "action_dispatch.logger" => Logger.new(output), - "action_dispatch.backtrace_cleaner" => backtrace_cleaner} + "action_dispatch.backtrace_cleaner" => backtrace_cleaner } get "/", headers: env assert_operator((output.rewind && output.read).lines.count, :>, 10) |