diff options
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/validations_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index 06b4740012..af7c975de1 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -189,4 +189,18 @@ class ValidationsTest < Test::Unit::TestCase t2.title = "Now Im really also unique" assert t2.save, "Should now save t2 as unique" end + + def test_validate_boundaries + Topic.validates_boundries_of(:title, :content, :within => 3..5) + + t = Topic.create("title" => "a!", "content" => "I'm ooooooooh so very long") + assert !t.save + assert_equal "is too short (min is 3 characters)", t.errors.on(:title) + assert_equal "is too long (max is 5 characters)", t.errors.on(:content) + + t.title = "abe" + t.content = "mad" + + assert t.save + end end
\ No newline at end of file |