aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-07-02 05:56:55 +0930
committerMatthew Draper <matthew@trebex.net>2016-07-02 06:09:10 +0930
commit1c7a3230ba28c578835d52c5b6d086c3b38f1b20 (patch)
treefe85ed8b997a78b67c068057e4e26b409757eb76
parent40fc3874f0ea720c0780b2eae72f48c0879f325e (diff)
downloadrails-1c7a3230ba28c578835d52c5b6d086c3b38f1b20.tar.gz
rails-1c7a3230ba28c578835d52c5b6d086c3b38f1b20.tar.bz2
rails-1c7a3230ba28c578835d52c5b6d086c3b38f1b20.zip
Ensure logging on exceptions only includes what we expect
-rw-r--r--actionpack/test/dispatch/debug_exceptions_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb
index 5a39db145e..6f3d30ebf9 100644
--- a/actionpack/test/dispatch/debug_exceptions_test.rb
+++ b/actionpack/test/dispatch/debug_exceptions_test.rb
@@ -362,6 +362,29 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest
assert_match(/puke/, output.rewind && output.read)
end
+ test 'logs only what is necessary' do
+ @app = DevelopmentApp
+ io = StringIO.new
+ logger = ActiveSupport::Logger.new(io)
+
+ _old, ActionView::Base.logger = ActionView::Base.logger, logger
+ begin
+ get "/", headers: { 'action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => logger }
+ ensure
+ ActionView::Base.logger = _old
+ end
+
+ output = io.rewind && io.read
+ lines = output.lines
+
+ # Other than the first three...
+ assert_equal([" \n", "RuntimeError (puke!):\n", " \n"], lines.slice!(0, 3))
+ lines.each do |line|
+ # .. all the remaining lines should be from the backtrace
+ assert_match(/:\d+:in /, line)
+ end
+ end
+
test 'uses backtrace cleaner from env' do
@app = DevelopmentApp
backtrace_cleaner = ActiveSupport::BacktraceCleaner.new