提交 b6a2113b 编写于 作者: J José Valim

Add failing tests, according to #480.

上级 9e4b715d
......@@ -66,6 +66,20 @@ def test_create_from_association_should_respect_default_scope
assert_equal 'exotic', bulb.name
end
def test_create_from_association_with_nil_values_should_work
car = Car.create(:name => 'honda')
bulb = car.bulbs.new(nil)
assert_equal 'defaulty', bulb.name
bulb = car.bulbs.build(nil)
assert_equal 'defaulty', bulb.name
bulb = car.bulbs.create(nil)
assert_equal 'defaulty', bulb.name
end
# When creating objects on the association, we must not do it within a scope (even though it
# would be convenient), because this would cause that scope to be applied to any callbacks etc.
def test_build_and_create_should_not_happen_within_scope
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册