diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-19 21:05:28 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-19 21:05:28 -0800 |
commit | bb106e9aa278a44cd970a3b820af1664fd85bba1 (patch) | |
tree | 72b68fa22fd78b40dfe0f6b6563c728d0c669e28 /activerecord | |
parent | a5144699cad4a992933f25c8b5b879bfa18abc10 (diff) | |
download | rails-bb106e9aa278a44cd970a3b820af1664fd85bba1.tar.gz rails-bb106e9aa278a44cd970a3b820af1664fd85bba1.tar.bz2 rails-bb106e9aa278a44cd970a3b820af1664fd85bba1.zip |
remove more uses of deprecated logger methods
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/log_subscriber_test.rb | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index dd0aeada51..1012bfbd94 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1888,7 +1888,7 @@ class BasicsTest < ActiveRecord::TestCase def test_silence_sets_log_level_to_error_in_block original_logger = ActiveRecord::Base.logger log = StringIO.new - ActiveRecord::Base.logger = Logger.new(log) + ActiveRecord::Base.logger = ActiveSupport::Logger.new(log) ActiveRecord::Base.logger.level = Logger::DEBUG ActiveRecord::Base.silence do ActiveRecord::Base.logger.warn "warn" @@ -1902,7 +1902,7 @@ class BasicsTest < ActiveRecord::TestCase def test_silence_sets_log_level_back_to_level_before_yield original_logger = ActiveRecord::Base.logger log = StringIO.new - ActiveRecord::Base.logger = Logger.new(log) + ActiveRecord::Base.logger = ActiveSupport::Logger.new(log) ActiveRecord::Base.logger.level = Logger::WARN ActiveRecord::Base.silence do end @@ -1930,9 +1930,7 @@ class BasicsTest < ActiveRecord::TestCase original_logger = ActiveRecord::Base.logger log = StringIO.new ActiveRecord::Base.logger = Logger.new(log) - ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => true) { ActiveRecord::Base.logger.debug "Loud" } ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => false) { ActiveRecord::Base.logger.debug "Quiet" } - assert_no_match(/Loud/, log.string) assert_match(/Quiet/, log.string) ensure ActiveRecord::Base.logger = original_logger diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index ae2c230d15..859c3d1947 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -8,6 +8,7 @@ require 'mocha' require 'active_record' require 'active_support/dependencies' +require 'active_support/logger' require 'support/config' require 'support/connection' @@ -90,7 +91,10 @@ end unless ENV['FIXTURE_DEBUG'] module ActiveRecord::TestFixtures::ClassMethods def try_to_load_dependency_with_silence(*args) - ActiveRecord::Base.logger.silence { try_to_load_dependency_without_silence(*args)} + old = ActiveRecord::Base.logger.level + ActiveRecord::Base.logger.level = ActiveSupport::Logger::ERROR + try_to_load_dependency_without_silence(*args) + ActiveRecord::Base.logger.level = old end alias_method_chain :try_to_load_dependency, :silence diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb index e24a5ca5aa..d1f0ace184 100644 --- a/activerecord/test/cases/log_subscriber_test.rb +++ b/activerecord/test/cases/log_subscriber_test.rb @@ -5,7 +5,7 @@ require "active_support/log_subscriber/test_helper" class LogSubscriberTest < ActiveRecord::TestCase include ActiveSupport::LogSubscriber::TestHelper - include ActiveSupport::BufferedLogger::Severity + include ActiveSupport::Logger::Severity fixtures :posts |