add test for bad email address

This commit is contained in:
joshua stein 2012-12-16 19:59:34 -06:00
parent c6c4169ae3
commit fecc2ef5bb

View file

@ -12,15 +12,20 @@ describe User do
it "has a valid email address" do
User.make!(:email => "user@example.com")
# duplicate
expect { User.make!(:email => "user@example.com") }.to raise_error
# bad address
expect { User.make!(:email => "user@") }.to raise_error
end
it "authenticates properly" do
u = User.make!(:password => "pilgrim")
u = User.make!(:password => "hunter2")
u.password_digest.length.should > 20
u.authenticate("pilgrim").should == u
u.authenticate("pilgriM").should == false
u.authenticate("hunter2").should == u
u.authenticate("hunteR2").should == false
end
end