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:
parent
3dfecfe773
commit
eec5eb2e44
1 changed files with 3 additions and 3 deletions
|
@ -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 }
|
||||||
|
|
Loading…
Reference in a new issue