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:
parent
cee2c85b07
commit
18cc7123ab
1 changed files with 3 additions and 2 deletions
|
@ -52,14 +52,15 @@ class PresenceValidationTest < ActiveRecord::TestCase
|
||||||
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? }
|
||||||
|
|
Loading…
Reference in a new issue