diff options
author | gmarik <gmarik@gmail.com> | 2013-12-31 13:46:33 -0600 |
---|---|---|
committer | gmarik <gmarik@gmail.com> | 2013-12-31 13:46:33 -0600 |
commit | aaf1af3cb83dad300c87e8abf2d1717cc528ff36 (patch) | |
tree | 41fdedd1e7fd20b06d8bb0aac7f29dcf8b223833 /activerecord/test | |
parent | 8ea00ed91a89997098edc9d83b8ecb26ed72f8fc (diff) | |
download | rails-aaf1af3cb83dad300c87e8abf2d1717cc528ff36.tar.gz rails-aaf1af3cb83dad300c87e8abf2d1717cc528ff36.tar.bz2 rails-aaf1af3cb83dad300c87e8abf2d1717cc528ff36.zip |
add test case
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/validations/presence_validation_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations/presence_validation_test.rb b/activerecord/test/cases/validations/presence_validation_test.rb index 1de8934406..fa04a7d02e 100644 --- a/activerecord/test/cases/validations/presence_validation_test.rb +++ b/activerecord/test/cases/validations/presence_validation_test.rb @@ -3,6 +3,8 @@ require "cases/helper" require 'models/man' require 'models/face' require 'models/interest' +require 'models/speedometer' +require 'models/dashboard' class PresenceValidationTest < ActiveRecord::TestCase class Boy < Man; end @@ -48,4 +50,19 @@ class PresenceValidationTest < ActiveRecord::TestCase i2.mark_for_destruction assert b.invalid? end + + + def test_validates_presence_doesnt_convert_to_array + Speedometer.validates_presence_of :dashboard + + dash = Dashboard.new + + # dashboard has to_a method + def dash.to_a; ['(/)', '(\)']; end + + s = Speedometer.new + s.dashboard = dash + + assert_nothing_raised { s.valid? } + end end |