Created
February 2, 2010 19:41
-
-
Save anonymous/292948 to your computer and use it in GitHub Desktop.
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
it "should not be valid without a name" do | |
@category = Category.new @valid_attributes | |
@category.name = nil | |
@category.should have(1).errors_on(:name) | |
end | |
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