Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment