diff options
Diffstat (limited to 'activerecord/test/validations_test.rb')
-rwxr-xr-x | activerecord/test/validations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index 8a918e2255..afd11c6d62 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -319,6 +319,13 @@ class ValidationsTest < Test::Unit::TestCase assert Topic.create("title" => nil, "content" => "abc").valid? end + def test_numericality_with_allow_nil_and_getter_method + Developer.validates_numericality_of( :salary, :allow_nil => true) + developer = Developer.new("name" => "michael", "salary" => nil) + developer.instance_eval("def salary; read_attribute('salary') ? read_attribute('salary') : 100000; end") + assert developer.valid? + end + def test_validates_exclusion_of Topic.validates_exclusion_of( :title, :in => %w( abe monkey ) ) |