diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-06-10 13:30:30 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-06-10 13:30:50 -0400 |
commit | 1de3db90463d2d55fccf0ce08e40bc00e5742ddf (patch) | |
tree | 49e07c4d10b75e3391d799904d254ca422e6b14e | |
parent | ee7de7d912036ffa1023346e9b8d0aa693cae7b2 (diff) | |
download | rails-1de3db90463d2d55fccf0ce08e40bc00e5742ddf.tar.gz rails-1de3db90463d2d55fccf0ce08e40bc00e5742ddf.tar.bz2 rails-1de3db90463d2d55fccf0ce08e40bc00e5742ddf.zip |
Make sure the yielded variable is the logger
-rw-r--r-- | activesupport/lib/active_support/logger.rb | 4 | ||||
-rw-r--r-- | activesupport/test/logger_test.rb | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/logger.rb b/activesupport/lib/active_support/logger.rb index a520e8f2f6..92b890dbb0 100644 --- a/activesupport/lib/active_support/logger.rb +++ b/activesupport/lib/active_support/logger.rb @@ -62,14 +62,14 @@ module ActiveSupport if respond_to?(:silence) super(level, &block) else - block.call(level) + block.call(self) end end else if respond_to?(:silence) super(level, &block) else - block.call(level) + block.call(self) end end end diff --git a/activesupport/test/logger_test.rb b/activesupport/test/logger_test.rb index 9881d15bbc..dfc5f3fdf4 100644 --- a/activesupport/test/logger_test.rb +++ b/activesupport/test/logger_test.rb @@ -148,7 +148,8 @@ class LoggerTest < ActiveSupport::TestCase @logger.extend ActiveSupport::Logger.broadcast(another_logger) @logger.debug "CORRECT DEBUG" - @logger.silence do + @logger.silence do |logger| + assert_kind_of ActiveSupport::Logger, logger @logger.debug "FAILURE" @logger.error "CORRECT ERROR" end @@ -169,7 +170,8 @@ class LoggerTest < ActiveSupport::TestCase @logger.extend ActiveSupport::Logger.broadcast(another_logger) @logger.debug "CORRECT DEBUG" - @logger.silence do + @logger.silence do |logger| + assert_kind_of ActiveSupport::Logger, logger @logger.debug "FAILURE" @logger.error "CORRECT ERROR" end |