From 6e2cba1c8b9da71852af4b70ba6755e1007f67aa Mon Sep 17 00:00:00 2001 From: David Date: Sat, 2 Feb 2013 13:00:52 +0800 Subject: test for issue 8931 --- activemodel/test/cases/validations/length_validation_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- cgit v1.2.3