1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix yet another implicit order dependant test

Signed-off-by: Michael Koziarski <michael@koziarski.com>
This commit is contained in:
Tarmo Tänav 2008-08-26 14:15:44 +03:00 committed by Michael Koziarski
parent 3dfecfe773
commit eec5eb2e44

View file

@ -260,9 +260,9 @@ class EagerAssociationTest < ActiveRecord::TestCase
end end
def test_eager_with_has_many_through def test_eager_with_has_many_through
posts_with_comments = people(:michael).posts.find(:all, :include => :comments) posts_with_comments = people(:michael).posts.find(:all, :include => :comments, :order => 'posts.id')
posts_with_author = people(:michael).posts.find(:all, :include => :author ) posts_with_author = people(:michael).posts.find(:all, :include => :author, :order => 'posts.id')
posts_with_comments_and_author = people(:michael).posts.find(:all, :include => [ :comments, :author ]) posts_with_comments_and_author = people(:michael).posts.find(:all, :include => [ :comments, :author ], :order => 'posts.id')
assert_equal 2, posts_with_comments.inject(0) { |sum, post| sum += post.comments.size } assert_equal 2, posts_with_comments.inject(0) { |sum, post| sum += post.comments.size }
assert_equal authors(:david), assert_no_queries { posts_with_author.first.author } assert_equal authors(:david), assert_no_queries { posts_with_author.first.author }
assert_equal authors(:david), assert_no_queries { posts_with_comments_and_author.first.author } assert_equal authors(:david), assert_no_queries { posts_with_comments_and_author.first.author }