diff options
author | jzw <zac@zacwilliams.com> | 2009-08-05 20:17:59 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-08 19:08:13 +0100 |
commit | 5ab94b2595836fe2de36fd632ba9577c459b1292 (patch) | |
tree | 6de1b8be18c5869c5ba524606ad3227a4dcb7d36 /activemodel/test/cases/validations | |
parent | c34d6279a06c80c51eefc3d345c24eab9a1e44fe (diff) | |
download | rails-5ab94b2595836fe2de36fd632ba9577c459b1292.tar.gz rails-5ab94b2595836fe2de36fd632ba9577c459b1292.tar.bz2 rails-5ab94b2595836fe2de36fd632ba9577c459b1292.zip |
validates_length_of with maximum should allow nil [#2309 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel/test/cases/validations')
-rw-r--r-- | activemodel/test/cases/validations/length_validation_test.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activemodel/test/cases/validations/length_validation_test.rb b/activemodel/test/cases/validations/length_validation_test.rb index 4a2f72feab..bc24900ecf 100644 --- a/activemodel/test/cases/validations/length_validation_test.rb +++ b/activemodel/test/cases/validations/length_validation_test.rb @@ -52,6 +52,13 @@ class LengthValidationTest < ActiveModel::TestCase assert_equal ["is too short (minimum is 5 characters)"], t.errors["title"] end + def test_validates_length_of_using_maximum_should_allow_nil + Topic.validates_length_of :title, :maximum => 10 + t = Topic.create + puts t.errors + assert t.valid? + end + def test_optionally_validates_length_of_using_minimum Topic.validates_length_of :title, :minimum => 5, :allow_nil => true @@ -75,9 +82,6 @@ class LengthValidationTest < ActiveModel::TestCase t.title = "" assert t.valid? - - t.title = nil - assert !t.valid? end def test_optionally_validates_length_of_using_maximum |