diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-02 09:00:54 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-02 10:16:13 +0200 |
commit | 3fc37e8ef96b3f139427189b58c426ec7fff65be (patch) | |
tree | d2541cd3727aea9c144f90662059766876168208 /activerecord | |
parent | de9166325b646d416ccca493d948ea37be2b137b (diff) | |
download | rails-3fc37e8ef96b3f139427189b58c426ec7fff65be.tar.gz rails-3fc37e8ef96b3f139427189b58c426ec7fff65be.tar.bz2 rails-3fc37e8ef96b3f139427189b58c426ec7fff65be.zip |
Fix failing AR test.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/identity_map_test.rb | 17 | ||||
-rw-r--r-- | activerecord/test/cases/log_subscriber_test.rb | 12 |
2 files changed, 12 insertions, 17 deletions
diff --git a/activerecord/test/cases/identity_map_test.rb b/activerecord/test/cases/identity_map_test.rb index 959c303d88..649715fbb5 100644 --- a/activerecord/test/cases/identity_map_test.rb +++ b/activerecord/test/cases/identity_map_test.rb @@ -1,5 +1,4 @@ require "cases/helper" -require "active_support/log_subscriber/test_helper" require 'models/developer' require 'models/project' @@ -28,8 +27,6 @@ class IdentityMapTest < ActiveRecord::TestCase :developers_projects, :computers, :authors, :author_addresses, :posts, :tags, :taggings, :comments, :subscribers - include ActiveSupport::LogSubscriber::TestHelper - ############################################################################## # Basic tests checking if IM is functioning properly on basic find operations# ############################################################################## @@ -386,20 +383,6 @@ class IdentityMapTest < ActiveRecord::TestCase assert_not_nil post.title end - def test_log - # FIXME: Can't seem to figure out why it isn't logging in test, works fine in a real app - pending "LogSubscriber wonkiness" - @old_logger = ActiveRecord::Base.logger - ActiveRecord::LogSubscriber.attach_to(:active_record) - - Post.find 1 - Post.find 1 - assert_match(/From Identity Map/, @logger.logged(:debug).last) - ensure - ActiveRecord::LogSubscriber.log_subscribers.pop - ActiveRecord::Base.logger = @old_logger - end - # Currently AR is not allowing changing primary key (see Persistence#update) # So we ignore it. If this changes, this test needs to be uncommented. # def test_updating_of_pkey diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb index 5f55299065..c6c6079490 100644 --- a/activerecord/test/cases/log_subscriber_test.rb +++ b/activerecord/test/cases/log_subscriber_test.rb @@ -1,11 +1,14 @@ require "cases/helper" require "models/developer" +require "models/post" require "active_support/log_subscriber/test_helper" class LogSubscriberTest < ActiveRecord::TestCase include ActiveSupport::LogSubscriber::TestHelper include ActiveSupport::BufferedLogger::Severity + fixtures :posts + def setup @old_logger = ActiveRecord::Base.logger @using_identity_map = ActiveRecord::IdentityMap.enabled? @@ -91,4 +94,13 @@ class LogSubscriberTest < ActiveRecord::TestCase def test_initializes_runtime Thread.new { assert_equal 0, ActiveRecord::LogSubscriber.runtime }.join end + + def test_log + ActiveRecord::IdentityMap.use do + Post.find 1 + Post.find 1 + end + wait + assert_match(/From Identity Map/, @logger.logged(:debug).last) + end end |