Permalink
Browse files

Remove the side-effects of validates_presence_of.

  • Loading branch information...
zuhao committed Jul 22, 2014
1 parent cee2c85 commit 18cc7123abffcbcbd255d02473da84c94a4c8c64
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/test/cases/validations/presence_validation_test.rb
@@ -52,14 +52,15 @@ def test_validates_presence_of_has_many_marked_for_destruction
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? }

0 comments on commit 18cc712

Please sign in to comment.