提交 15a03ca9 编写于 作者: E Emilio Tagua

No need to test against target anymore.

上级 0b702ba3
......@@ -105,15 +105,15 @@ def test_owner_object_is_associated_from_identity_map
assert_no_queries do
comment.post
end
assert_same post, comment.post.target
assert_same post, comment.post
end
def test_associated_object_are_assigned_from_identity_map
post = Post.find(1)
post.comments.each do |comment|
assert_same post, comment.post.target
assert_equal post.object_id, comment.post.target.object_id
assert_same post, comment.post
assert_equal post.object_id, comment.post.object_id
end
end
......@@ -176,7 +176,7 @@ def test_has_many_associations
pirate.reload
pirate.birds_attributes = [{ :id => posideons.id, :name => 'Grace OMalley' }]
assert_equal 'Grace OMalley', pirate.birds.send(:load_target).find { |r| r.id == posideons.id }.name
assert_equal 'Grace OMalley', pirate.birds.send(:load).find { |r| r.id == posideons.id }.name
end
def test_changing_associations
......@@ -267,20 +267,20 @@ def test_eager_loading_with_conditions_on_joined_table_preloads
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
assert_same posts.first.author, Author.first
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
assert_same posts.first.author, Author.first
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
assert_same posts.first.author, Author.first
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
assert_same posts.first.author, Author.first
end
def test_eager_loading_with_conditions_on_string_joined_table_preloads
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册