Skip to content
This repository
Browse code

Update number of queries executed instead of avoiding IM.

  • Loading branch information...
commit 6cd1224f2eae69a44c820918657408b7650c1288 1 parent 7892543
Emilio Tagua miloops authored

Showing 1 changed file with 5 additions and 9 deletions. Show diff stats Hide diff stats

  1. +5 9 activerecord/test/cases/relations_test.rb
14 activerecord/test/cases/relations_test.rb
@@ -263,13 +263,12 @@ def test_eager_association_loading_of_stis_with_multiple_references
263 263 end
264 264
265 265 def test_find_with_preloaded_associations
266   - ActiveRecord::IdentityMap.without do
267 266 assert_queries(2) do
268 267 posts = Post.preload(:comments)
269 268 assert posts.first.comments.first
270 269 end
271 270
272   - assert_queries(2) do
  271 + assert_queries(1) do
273 272 posts = Post.preload(:comments).to_a
274 273 assert posts.first.comments.first
275 274 end
@@ -279,27 +278,25 @@ def test_find_with_preloaded_associations
279 278 assert posts.first.author
280 279 end
281 280
282   - assert_queries(2) do
  281 + assert_queries(1) do
283 282 posts = Post.preload(:author).to_a
284 283 assert posts.first.author
285 284 end
286 285
287   - assert_queries(3) do
  286 + assert_queries(1) do
288 287 posts = Post.preload(:author, :comments).to_a
289 288 assert posts.first.author
290 289 assert posts.first.comments.first
291 290 end
292   - end
293 291 end
294 292
295 293 def test_find_with_included_associations
296   - ActiveRecord::IdentityMap.without do
297 294 assert_queries(2) do
298 295 posts = Post.includes(:comments)
299 296 assert posts.first.comments.first
300 297 end
301 298
302   - assert_queries(2) do
  299 + assert_queries(1) do
303 300 posts = Post.scoped.includes(:comments)
304 301 assert posts.first.comments.first
305 302 end
@@ -309,12 +306,11 @@ def test_find_with_included_associations
309 306 assert posts.first.author
310 307 end
311 308
312   - assert_queries(3) do
  309 + assert_queries(1) do
313 310 posts = Post.includes(:author, :comments).to_a
314 311 assert posts.first.author
315 312 assert posts.first.comments.first
316 313 end
317   - end
318 314 end
319 315
320 316 def test_default_scope_with_conditions_string

0 comments on commit 6cd1224

Please sign in to comment.
Something went wrong with that request. Please try again.