Created
May 21, 2009 14:42
-
-
Save Hates/115494 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
describe "validation" do | |
it 'requires password' do | |
user = Factory.build(:user, :password => nil) | |
user.should_not be_valid | |
user.errors.on(:password).should_not be_nil | |
end | |
it 'requires password confirmation' do | |
user = Factory.build(:user, :password => 'password', :password_confirmation => ' ') | |
user.should_not be_valid | |
user.errors.on(:password).should_not be_nil | |
end | |
it "requires a password that matches" do | |
user = Factory.build(:user, :password => "password", :password_confirmation => "password_confirmation") | |
user.should_not be_valid | |
user.errors.on(:password).should_not be_nil | |
end | |
it "requires firstname" do | |
user = Factory.build(:user, :firstname => nil) | |
user.should_not be_valid | |
user.errors.on(:firstname).should_not be_nil | |
end | |
it "requires lastname" do | |
user = Factory.build(:user, :lastname => nil) | |
user.should_not be_valid | |
user.errors.on(:lastname).should_not be_nil | |
end | |
it "requires telephone" do | |
user = Factory.build(:user, :telephone => nil) | |
user.should_not be_valid | |
user.errors.on(:telephone).should_not be_nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment