Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

avoid deprecation warnings when running AR tests

  • Loading branch information...
commit a410a9c8f7197bc321e1adde46fa98af8a2176ad 1 parent b590fe4
@tenderlove tenderlove authored
View
4 activerecord/test/cases/base_test.rb
@@ -1951,7 +1951,9 @@ def test_benchmark_with_use_silence
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)
View
5 activerecord/test/cases/helper.rb
@@ -90,7 +90,10 @@ def call(name, start, finish, message_id, values)
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
Please sign in to comment.
Something went wrong with that request. Please try again.