diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-10-20 19:18:30 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-11-19 19:08:58 -0300 |
commit | 6cd1224f2eae69a44c820918657408b7650c1288 (patch) | |
tree | 865189b90caff5e295130154112d5261b5c52f91 /activerecord/test/cases/relations_test.rb | |
parent | 7892543a88e5ec2329e3834a591a7b3b80d165f0 (diff) | |
download | rails-6cd1224f2eae69a44c820918657408b7650c1288.tar.gz rails-6cd1224f2eae69a44c820918657408b7650c1288.tar.bz2 rails-6cd1224f2eae69a44c820918657408b7650c1288.zip |
Update number of queries executed instead of avoiding IM.
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index eb268017f8..2809554e4f 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -263,13 +263,12 @@ class RelationTest < ActiveRecord::TestCase end def test_find_with_preloaded_associations - ActiveRecord::IdentityMap.without do assert_queries(2) do posts = Post.preload(:comments) 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 @@ -279,27 +278,25 @@ 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 end - end end def test_find_with_included_associations - ActiveRecord::IdentityMap.without do assert_queries(2) do posts = Post.includes(:comments) 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 @@ -309,12 +306,11 @@ 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 end - end end def test_default_scope_with_conditions_string |