diff options
author | José Valim <jose.valim@gmail.com> | 2010-07-20 21:20:19 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-20 21:21:14 +0200 |
commit | d4151d7f0ac4a0823e788c0beed9ec2476e72386 (patch) | |
tree | 79576edab9209c77bfb118296ee40f4bad9b7a64 /railties/test | |
parent | e1df4b956882f0c10a310088c1c13dcaa655a3b1 (diff) | |
download | rails-d4151d7f0ac4a0823e788c0beed9ec2476e72386.tar.gz rails-d4151d7f0ac4a0823e788c0beed9ec2476e72386.tar.bz2 rails-d4151d7f0ac4a0823e788c0beed9ec2476e72386.zip |
Fix a failing test in Railtie and properly define all severity levels in MockLogger for LogSubscriber.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/initializers/notifications_test.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/railties/test/application/initializers/notifications_test.rb b/railties/test/application/initializers/notifications_test.rb index fc8548af1f..7e035be764 100644 --- a/railties/test/application/initializers/notifications_test.rb +++ b/railties/test/application/initializers/notifications_test.rb @@ -1,17 +1,6 @@ require "isolation/abstract_unit" module ApplicationTests - class MockLogger - def method_missing(*args) - @logged ||= [] - @logged << args.last - end - - def logged - @logged.compact.map { |l| l.to_s.strip } - end - end - class NotificationsTest < Test::Unit::TestCase include ActiveSupport::Testing::Isolation @@ -34,15 +23,17 @@ module ApplicationTests RUBY require "#{app_path}/config/environment" + require "active_support/log_subscriber/test_helper" - ActiveRecord::Base.logger = logger = MockLogger.new + logger = ActiveSupport::LogSubscriber::TestHelper::MockLogger.new + ActiveRecord::Base.logger = logger # Mimic Active Record notifications instrument "sql.active_record", :name => "SQL", :sql => "SHOW tables" wait - assert_equal 1, logger.logged.size - assert_match /SHOW tables/, logger.logged.last + assert_equal 1, logger.logged(:debug).size + assert_match /SHOW tables/, logger.logged(:debug).last end end end |