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

Add explicit ordering in relations_test.rb, as the lack of this was causing failures against postgres

This commit is contained in:
Jon Leighton 2010-10-19 19:33:25 +01:00
parent d15de7d97f
commit 383d545c88

View file

@ -251,27 +251,27 @@ class RelationTest < ActiveRecord::TestCase
def test_find_with_preloaded_associations
assert_queries(2) do
posts = Post.preload(:comments)
posts = Post.preload(:comments).order('posts.id')
assert posts.first.comments.first
end
assert_queries(2) do
posts = Post.preload(:comments).to_a
posts = Post.preload(:comments).order('posts.id').to_a
assert posts.first.comments.first
end
assert_queries(2) do
posts = Post.preload(:author)
posts = Post.preload(:author).order('posts.id')
assert posts.first.author
end
assert_queries(2) do
posts = Post.preload(:author).to_a
posts = Post.preload(:author).order('posts.id').to_a
assert posts.first.author
end
assert_queries(3) do
posts = Post.preload(:author, :comments).to_a
posts = Post.preload(:author, :comments).order('posts.id').to_a
assert posts.first.author
assert posts.first.comments.first
end
@ -279,22 +279,22 @@ class RelationTest < ActiveRecord::TestCase
def test_find_with_included_associations
assert_queries(2) do
posts = Post.includes(:comments)
posts = Post.includes(:comments).order('posts.id')
assert posts.first.comments.first
end
assert_queries(2) do
posts = Post.scoped.includes(:comments)
posts = Post.scoped.includes(:comments).order('posts.id')
assert posts.first.comments.first
end
assert_queries(2) do
posts = Post.includes(:author)
posts = Post.includes(:author).order('posts.id')
assert posts.first.author
end
assert_queries(3) do
posts = Post.includes(:author, :comments).to_a
posts = Post.includes(:author, :comments).order('posts.id').to_a
assert posts.first.author
assert posts.first.comments.first
end