-
-
Save ldenman/292955 to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for testing validates_length_of :name, :within => 3..100, :allow_nil => true | |
it "should not be valid with a name having less than 3 or more than 100 characters, if name is given" do | |
@category = Category.new @valid_attributes | |
@category.name = 'to' | |
@category.should have(1).errors_on(:name) | |
@category.errors.on(:name).should include "too short" | |
@category = Category.new @valid_attributes | |
@category.name = 't'*101 | |
@category.should have(1).errors_on(:name) | |
@category.errors.on(:name).should include "too long" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment