Skip to content
This repository
Browse code

Refactor test to avoid hackery

  • Loading branch information...
commit e68a83c9ecdc5b9395e0dde687cafdf8330f9de0 1 parent bbe0a50
Jon Leighton jonleighton authored

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

  1. +4 4 activerecord/test/cases/associations/join_model_test.rb
8 activerecord/test/cases/associations/join_model_test.rb
@@ -516,10 +516,10 @@ def test_has_many_through_collection_size_doesnt_load_target_if_not_loaded
516 516 end
517 517
518 518 def test_has_many_through_collection_size_uses_counter_cache_if_it_exists
519   - author = authors(:david)
520   - author.stubs(:_read_attribute).with('comments_count').returns(100)
521   - assert_equal 100, author.comments.size
522   - assert !author.comments.loaded?
  519 + c = categories(:general)
  520 + c.categorizations_count = 100
  521 + assert_equal 100, c.categorizations.size
  522 + assert !c.categorizations.loaded?
523 523 end
524 524
525 525 def test_adding_junk_to_has_many_through_should_raise_type_mismatch

0 comments on commit e68a83c

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