提交 c5888508 编写于 作者: C Carlos Antonio da Silva

Refactor test to not care about the specific result of valid?

Only care about its truthiness rather than asserting specific true/false
values. If we need to check for the return value in particular, there will
be a test for that.
上级 de804e90
......@@ -1886,11 +1886,12 @@ def test_collection_association_with_private_kernel_method
end
end
test 'has_many_association passes context validation to validate children' do
test 'passes custom context validation to validate children' do
pirate = FamousPirate.new
pirate.famous_ships << ship = FamousShip.new
assert_equal true, pirate.valid?
assert_equal false, pirate.valid?(:conference)
assert pirate.valid?
assert_not pirate.valid?(:conference)
assert_equal "can't be blank", ship.errors[:name].first
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册