Fixed #332 Allow users to reset their password (#335)

* <Added password reset system>

* <Added rspec tests>

* <Fixed code style>

* <Added rescue for invalid smtp configuration>
This commit is contained in:
John Ma
2018-12-21 11:56:52 -05:00
committed by Jesus Federico
parent e3389c84d1
commit 8fe66d81f1
15 changed files with 513 additions and 3 deletions

View File

@ -109,4 +109,21 @@ describe User, type: :model do
expect(user.name_chunk).to eq("exa")
end
end
context 'password reset' do
it 'creates token and respective reset digest' do
user = create(:user)
reset_digest_success = user.create_reset_digest
expect(reset_digest_success).to eq(true)
end
it 'verifies if password reset link expired' do
user = create(:user)
user.create_reset_digest
expired = user.password_reset_expired?
expect(expired).to be_in([true, false])
end
end
end