提交 18cc7123 编写于 作者: Z Zuhao Wan

Remove the side-effects of validates_presence_of.

上级 cee2c85b
...@@ -52,14 +52,15 @@ def test_validates_presence_of_has_many_marked_for_destruction ...@@ -52,14 +52,15 @@ def test_validates_presence_of_has_many_marked_for_destruction
end end
def test_validates_presence_doesnt_convert_to_array def test_validates_presence_doesnt_convert_to_array
Speedometer.validates_presence_of :dashboard speedometer = Class.new(Speedometer)
speedometer.validates_presence_of :dashboard
dash = Dashboard.new dash = Dashboard.new
# dashboard has to_a method # dashboard has to_a method
def dash.to_a; ['(/)', '(\)']; end def dash.to_a; ['(/)', '(\)']; end
s = Speedometer.new s = speedometer.new
s.dashboard = dash s.dashboard = dash
assert_nothing_raised { s.valid? } assert_nothing_raised { s.valid? }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册