Permalink
Browse files

Remove ActiveSupport::Benchmarkable#silence was deprecated.

  • Loading branch information...
kennyj committed Jun 1, 2013
1 parent 6f3e01e commit f8f30c88ad6190589e34f18813031f6c260e71dd
Showing with 0 additions and 42 deletions.
  1. +0 −32 activerecord/test/cases/base_test.rb
  2. +0 −10 activesupport/lib/active_support/benchmarkable.rb
@@ -1228,38 +1228,6 @@ def test_assert_queries
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
@@ -45,15 +45,5 @@ def benchmark(message = "Benchmarking", options = {})
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

0 comments on commit f8f30c8

Please sign in to comment.