1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove the side-effects of validates_presence_of.

This commit is contained in:
Zuhao Wan 2014-07-22 10:09:05 +08:00
parent cee2c85b07
commit 18cc7123ab

View file

@ -52,14 +52,15 @@ class PresenceValidationTest < ActiveRecord::TestCase
end
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
# dashboard has to_a method
def dash.to_a; ['(/)', '(\)']; end
s = Speedometer.new
s = speedometer.new
s.dashboard = dash
assert_nothing_raised { s.valid? }