diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-21 17:46:20 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-11-19 19:08:10 -0300 |
commit | 21483cbc6755b1a8aae5bc2285fb439c22fb5265 (patch) | |
tree | da6266e5f934339e322e6bd0e2f6b58a6e80c35d /activerecord | |
parent | cd6d6fcb239f08ce039d2f70960014477f4e550b (diff) | |
download | rails-21483cbc6755b1a8aae5bc2285fb439c22fb5265.tar.gz rails-21483cbc6755b1a8aae5bc2285fb439c22fb5265.tar.bz2 rails-21483cbc6755b1a8aae5bc2285fb439c22fb5265.zip |
Testing objects equality is what we are looking for here, no query caching.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/identity_map_test.rb | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/activerecord/test/cases/identity_map_test.rb b/activerecord/test/cases/identity_map_test.rb index f9eef250d3..d5ef993a8c 100644 --- a/activerecord/test/cases/identity_map_test.rb +++ b/activerecord/test/cases/identity_map_test.rb @@ -205,27 +205,23 @@ class IdentityMapTest < ActiveRecord::TestCase end def test_eager_loading_with_conditions_on_joined_table_preloads - posts = assert_queries(2) do - Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id') - end + posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id') assert_equal [posts(:welcome)], posts assert_equal authors(:david), assert_no_queries { posts[0].author} + assert_same posts.first.author.target, Author.first - posts = assert_queries(1) do - Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id') - end + posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id') assert_equal [posts(:welcome)], posts assert_equal authors(:david), assert_no_queries { posts[0].author} + assert_same posts.first.author.target, Author.first - posts = assert_queries(1) do - Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => "tags.name = 'General'", :order => 'posts.id') - end + posts = Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => "tags.name = 'General'", :order => 'posts.id') assert_equal posts(:welcome, :thinking), posts + assert_same posts.first.author.target, Author.first - posts = assert_queries(1) do - Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => "taggings_tags.super_tag_id=2", :order => 'posts.id') - end + posts = Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => "taggings_tags.super_tag_id=2", :order => 'posts.id') assert_equal posts(:welcome, :thinking), posts + assert_same posts.first.author.target, Author.first end def test_eager_loading_with_conditions_on_string_joined_table_preloads |