提交 1c7a3230 编写于 作者: M Matthew Draper

Ensure logging on exceptions only includes what we expect

上级 40fc3874
......@@ -362,6 +362,29 @@ def call(env)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册