diff options
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 20bfafbc5e..b3d4305f7c 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -279,7 +279,7 @@ class RelationTest < ActiveRecord::TestCase assert posts.first.comments.first end - assert_queries(2) do + assert_queries(1) do posts = Post.preload(:comments).to_a assert posts.first.comments.first end @@ -289,12 +289,12 @@ class RelationTest < ActiveRecord::TestCase assert posts.first.author end - assert_queries(2) do + assert_queries(1) do posts = Post.preload(:author).to_a assert posts.first.author end - assert_queries(3) do + assert_queries(1) do posts = Post.preload(:author, :comments).to_a assert posts.first.author assert posts.first.comments.first @@ -307,7 +307,7 @@ class RelationTest < ActiveRecord::TestCase assert posts.first.comments.first end - assert_queries(2) do + assert_queries(1) do posts = Post.scoped.includes(:comments) assert posts.first.comments.first end @@ -317,7 +317,7 @@ class RelationTest < ActiveRecord::TestCase assert posts.first.author end - assert_queries(3) do + assert_queries(1) do posts = Post.includes(:author, :comments).to_a assert posts.first.author assert posts.first.comments.first @@ -563,9 +563,11 @@ class RelationTest < ActiveRecord::TestCase end def test_relation_merging_with_preload + ActiveRecord::IdentityMap.without do [Post.scoped & Post.preload(:author), Post.preload(:author) & Post.scoped].each do |posts| assert_queries(2) { assert posts.first.author } end + end end def test_relation_merging_with_joins |