You can only reuse email tokens within 24 hours.

This commit is contained in:
Robin Ward
2014-03-04 14:03:04 -05:00
parent 15c9c90533
commit aa3f7f764d
2 changed files with 15 additions and 1 deletions

View File

@ -118,6 +118,16 @@ describe EmailToken do
email_token.should be_confirmed
end
it "can be confirmed again" do
EmailToken.stubs(:confirm_valid_after).returns(1.hour.ago)
EmailToken.confirm(email_token.token).should == user
# Unless `confirm_valid_after` has passed
EmailToken.stubs(:confirm_valid_after).returns(1.hour.from_now)
EmailToken.confirm(email_token.token).should be_blank
end
end