diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-24 10:43:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-24 10:43:23 -0700 |
commit | a410a9c8f7197bc321e1adde46fa98af8a2176ad (patch) | |
tree | 01dcd01b9772eecce2defd0f4e73c2c75745ccfb | |
parent | b590fe4892d312cbdde350e7c4f8fbbcaf8c61ee (diff) | |
download | rails-a410a9c8f7197bc321e1adde46fa98af8a2176ad.tar.gz rails-a410a9c8f7197bc321e1adde46fa98af8a2176ad.tar.bz2 rails-a410a9c8f7197bc321e1adde46fa98af8a2176ad.zip |
avoid deprecation warnings when running AR tests
-rw-r--r-- | activerecord/test/cases/base_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 5158b057be..a109c50e2a 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1951,7 +1951,9 @@ 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" } + assert_deprecated do + ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => true) { ActiveRecord::Base.logger.debug "Loud" } + end ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => false) { ActiveRecord::Base.logger.debug "Quiet" } assert_no_match(/Loud/, log.string) assert_match(/Quiet/, log.string) diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index ae2c230d15..e352a55104 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -90,7 +90,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 = Logger::ERROR + try_to_load_dependency_without_silence(*args) + ActiveRecord::Base.logger.level = old end alias_method_chain :try_to_load_dependency, :silence |