diff options
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/test/cases/validations/length_validation_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activemodel/test/cases/validations/length_validation_test.rb b/activemodel/test/cases/validations/length_validation_test.rb index 1a40ca8efc..e704c347fe 100644 --- a/activemodel/test/cases/validations/length_validation_test.rb +++ b/activemodel/test/cases/validations/length_validation_test.rb @@ -414,4 +414,12 @@ class LengthValidationTest < ActiveModel::TestCase t.title = "" assert t.valid? end + + def test_validates_with_diff_in_option + Topic.validates_length_of( :title, :is => 5) + Topic.validates_length_of( :title, :is => 5, :if => Proc.new { false } ) + + assert Topic.new("title" => "david").valid? + assert Topic.new("title" => "david2").invalid? + end end |