diff options
author | David <DevilDavidWang@gmail.com> | 2013-02-02 13:00:52 +0800 |
---|---|---|
committer | David <DevilDavidWang@gmail.com> | 2013-02-02 13:00:52 +0800 |
commit | 6e2cba1c8b9da71852af4b70ba6755e1007f67aa (patch) | |
tree | 280354f51e52ddb534045e275d5e176552d8c54f | |
parent | 3e1f23125dc04df7894f276f6e3d296e184c2b8c (diff) | |
download | rails-6e2cba1c8b9da71852af4b70ba6755e1007f67aa.tar.gz rails-6e2cba1c8b9da71852af4b70ba6755e1007f67aa.tar.bz2 rails-6e2cba1c8b9da71852af4b70ba6755e1007f67aa.zip |
test for issue 8931
-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 |