add test for bad email address
This commit is contained in:
parent
c6c4169ae3
commit
fecc2ef5bb
|
@ -12,15 +12,20 @@ describe User do
|
||||||
|
|
||||||
it "has a valid email address" do
|
it "has a valid email address" do
|
||||||
User.make!(:email => "user@example.com")
|
User.make!(:email => "user@example.com")
|
||||||
|
|
||||||
|
# duplicate
|
||||||
expect { User.make!(:email => "user@example.com") }.to raise_error
|
expect { User.make!(:email => "user@example.com") }.to raise_error
|
||||||
|
|
||||||
|
# bad address
|
||||||
|
expect { User.make!(:email => "user@") }.to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it "authenticates properly" do
|
it "authenticates properly" do
|
||||||
u = User.make!(:password => "pilgrim")
|
u = User.make!(:password => "hunter2")
|
||||||
|
|
||||||
u.password_digest.length.should > 20
|
u.password_digest.length.should > 20
|
||||||
|
|
||||||
u.authenticate("pilgrim").should == u
|
u.authenticate("hunter2").should == u
|
||||||
u.authenticate("pilgriM").should == false
|
u.authenticate("hunteR2").should == false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue