mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Add order clauses to fix some tests which were failing under 1.8 on oracle and postgres
This commit is contained in:
@@ -207,31 +207,31 @@ class IdentityMapTest < 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
|
||||
|
||||
# With IM we'll retrieve post object from previous query, it'll have comments
|
||||
# already preloaded from first call
|
||||
assert_queries(1) do
|
||||
posts = Post.preload(:comments).to_a
|
||||
posts = Post.preload(:comments).order('posts.id')
|
||||
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
|
||||
|
||||
# With IM we'll retrieve post object from previous query, it'll have comments
|
||||
# already preloaded from first call
|
||||
assert_queries(1) do
|
||||
posts = Post.preload(:author).to_a
|
||||
posts = Post.preload(:author).order('posts.id')
|
||||
assert posts.first.author
|
||||
end
|
||||
|
||||
assert_queries(1) do
|
||||
posts = Post.preload(:author, :comments).to_a
|
||||
posts = Post.preload(:author, :comments).order('posts.id')
|
||||
assert posts.first.author
|
||||
assert posts.first.comments.first
|
||||
end
|
||||
@@ -239,22 +239,22 @@ class IdentityMapTest < 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(1) 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(1) do
|
||||
posts = Post.includes(:author, :comments).to_a
|
||||
posts = Post.includes(:author, :comments).order('posts.id')
|
||||
assert posts.first.author
|
||||
assert posts.first.comments.first
|
||||
end
|
||||
|
||||
@@ -286,7 +286,7 @@ class RelationTest < ActiveRecord::TestCase
|
||||
end
|
||||
|
||||
assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do
|
||||
posts = Post.preload(:comments).to_a
|
||||
posts = Post.preload(:comments).order('posts.id')
|
||||
assert posts.first.comments.first
|
||||
end
|
||||
|
||||
@@ -296,12 +296,12 @@ class RelationTest < ActiveRecord::TestCase
|
||||
end
|
||||
|
||||
assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do
|
||||
posts = Post.preload(:author).to_a
|
||||
posts = Post.preload(:author).order('posts.id')
|
||||
assert posts.first.author
|
||||
end
|
||||
|
||||
assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 3) do
|
||||
posts = Post.preload(:author, :comments).to_a
|
||||
posts = Post.preload(:author, :comments).order('posts.id')
|
||||
assert posts.first.author
|
||||
assert posts.first.comments.first
|
||||
end
|
||||
@@ -314,7 +314,7 @@ class RelationTest < ActiveRecord::TestCase
|
||||
end
|
||||
|
||||
assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do
|
||||
posts = Post.scoped.includes(:comments)
|
||||
posts = Post.scoped.includes(:comments).order('posts.id')
|
||||
assert posts.first.comments.first
|
||||
end
|
||||
|
||||
@@ -324,7 +324,7 @@ class RelationTest < ActiveRecord::TestCase
|
||||
end
|
||||
|
||||
assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 3) do
|
||||
posts = Post.includes(:author, :comments).to_a
|
||||
posts = Post.includes(:author, :comments).order('posts.id')
|
||||
assert posts.first.author
|
||||
assert posts.first.comments.first
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user