This repository has been archived by the owner on Apr 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
15 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module ActiveModel | ||
class PasswordReset | ||
VERSION = "1.0.2" | ||
VERSION = "1.0.3" | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,20 +51,24 @@ def test_is_invalid_without_email | |
|
||
def test_find_raises_exception_with_invalid_email | ||
token = ActiveModel::PasswordReset::MessageVerifier.generate(["[email protected]", Digest::MD5.digest("alicedigest"), Time.now.to_i + 3600]) | ||
assert_raises(ActiveModel::PasswordReset::EmailInvalid) { ActiveModel::PasswordReset.find(CGI.escape(token)) } | ||
assert_raises(ActiveModel::PasswordReset::EmailInvalid) { ActiveModel::PasswordReset.find(token) } | ||
end | ||
|
||
def test_find_raises_exception_with_invalid_token | ||
assert_raises(ActiveModel::PasswordReset::TokenInvalid) { ActiveModel::PasswordReset.find("invalidtoken") } | ||
end | ||
|
||
def test_find_raises_exception_with_non_base64_token | ||
assert_raises(ActiveModel::PasswordReset::TokenInvalid) { ActiveModel::PasswordReset.find("%%%%%%%%%") } | ||
end | ||
|
||
def test_find_raises_exception_with_expired_token | ||
token = ActiveModel::PasswordReset::MessageVerifier.generate(["[email protected]", Digest::MD5.digest("alicedigest"), Time.now.to_i - 3600]) | ||
assert_raises(ActiveModel::PasswordReset::TokenExpired) { ActiveModel::PasswordReset.find(CGI.escape(token)) } | ||
assert_raises(ActiveModel::PasswordReset::TokenExpired) { ActiveModel::PasswordReset.find(token) } | ||
end | ||
|
||
def test_find_raises_exception_with_changed_password | ||
token = ActiveModel::PasswordReset::MessageVerifier.generate(["[email protected]", Digest::MD5.digest("anotheralicedigest"), Time.now.to_i + 3600]) | ||
assert_raises(ActiveModel::PasswordReset::PasswordChanged) { ActiveModel::PasswordReset.find(CGI.escape(token)) } | ||
assert_raises(ActiveModel::PasswordReset::PasswordChanged) { ActiveModel::PasswordReset.find(token) } | ||
end | ||
end |