Remove ActiveSupport::Benchmarkable#silence was deprecated.

This commit is contained in:
kennyj 2013-06-01 13:08:45 +09:00
parent 6f3e01e8b7
commit f8f30c88ad
2 changed files with 0 additions and 42 deletions

View File

@ -1228,38 +1228,6 @@ class BasicsTest < ActiveRecord::TestCase
assert_no_queries { assert true }
end
def test_silence_sets_log_level_to_error_in_block
original_logger = ActiveRecord::Base.logger
assert_deprecated do
log = StringIO.new
ActiveRecord::Base.logger = ActiveSupport::Logger.new(log)
ActiveRecord::Base.logger.level = Logger::DEBUG
ActiveRecord::Base.silence do
ActiveRecord::Base.logger.warn "warn"
ActiveRecord::Base.logger.error "error"
end
assert_equal "error\n", log.string
end
ensure
ActiveRecord::Base.logger = original_logger
end
def test_silence_sets_log_level_back_to_level_before_yield
original_logger = ActiveRecord::Base.logger
assert_deprecated do
log = StringIO.new
ActiveRecord::Base.logger = ActiveSupport::Logger.new(log)
ActiveRecord::Base.logger.level = Logger::WARN
ActiveRecord::Base.silence do
end
assert_equal Logger::WARN, ActiveRecord::Base.logger.level
end
ensure
ActiveRecord::Base.logger = original_logger
end
def test_benchmark_with_log_level
original_logger = ActiveRecord::Base.logger
log = StringIO.new

View File

@ -45,15 +45,5 @@ module ActiveSupport
yield
end
end
# Silence the logger during the execution of the block.
def silence
message = "ActiveSupport::Benchmarkable#silence is deprecated. It will be removed from Rails 4.1."
ActiveSupport::Deprecation.warn message
old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger
yield
ensure
logger.level = old_logger_level if logger
end
end
end