1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

test for issue 8931

This commit is contained in:
David 2013-02-02 13:00:52 +08:00
parent 3e1f23125d
commit 6e2cba1c8b

View file

@ -414,4 +414,12 @@ class LengthValidationTest < ActiveModel::TestCase
t.title = "" t.title = ""
assert t.valid? assert t.valid?
end 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 end