提交 e68a83c9 编写于 作者: J Jon Leighton

Refactor test to avoid hackery

上级 bbe0a507
......@@ -516,10 +516,10 @@ def test_has_many_through_collection_size_doesnt_load_target_if_not_loaded
end
def test_has_many_through_collection_size_uses_counter_cache_if_it_exists
author = authors(:david)
author.stubs(:_read_attribute).with('comments_count').returns(100)
assert_equal 100, author.comments.size
assert !author.comments.loaded?
c = categories(:general)
c.categorizations_count = 100
assert_equal 100, c.categorizations.size
assert !c.categorizations.loaded?
end
def test_adding_junk_to_has_many_through_should_raise_type_mismatch
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册