diff options
author | Zuhao Wan <wanzuhao@gmail.com> | 2014-07-22 10:09:05 +0800 |
---|---|---|
committer | Zuhao Wan <wanzuhao@gmail.com> | 2014-07-22 10:09:05 +0800 |
commit | 18cc7123abffcbcbd255d02473da84c94a4c8c64 (patch) | |
tree | 954fabb234e13b4786caf0fcaaff4e7b942dbb41 /activerecord/test | |
parent | cee2c85b07317524861ba14b51d8e7e9b34966ba (diff) | |
download | rails-18cc7123abffcbcbd255d02473da84c94a4c8c64.tar.gz rails-18cc7123abffcbcbd255d02473da84c94a4c8c64.tar.bz2 rails-18cc7123abffcbcbd255d02473da84c94a4c8c64.zip |
Remove the side-effects of validates_presence_of.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/validations/presence_validation_test.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/test/cases/validations/presence_validation_test.rb b/activerecord/test/cases/validations/presence_validation_test.rb index 3790d3c8cf..4f38849131 100644 --- a/activerecord/test/cases/validations/presence_validation_test.rb +++ b/activerecord/test/cases/validations/presence_validation_test.rb @@ -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? } |