diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-10-01 21:41:56 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-10-01 21:41:56 -0400 |
commit | ad7ad8745a33581680091c5ade9377c0aae74715 (patch) | |
tree | 3ae71778a92fecd9e4d70303d9aff9982e492bc6 /spec | |
parent | 19748ddee6ef4c794d6cc30cdf1c607088cc5bf7 (diff) | |
download | gitlab-ce-ad7ad8745a33581680091c5ade9377c0aae74715.tar.gz |
Add User#recently_sent_password_reset?
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/user_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 480950859a2..b45c78f38de 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -227,6 +227,26 @@ describe User do end end + describe 'recently_sent_password_reset?' do + it 'is false when reset_password_sent_at is nil' do + user = build_stubbed(:user, reset_password_sent_at: nil) + + expect(user.recently_sent_password_reset?).to eq false + end + + it 'is false when sent more than one minute ago' do + user = build_stubbed(:user, reset_password_sent_at: 5.minutes.ago) + + expect(user.recently_sent_password_reset?).to eq false + end + + it 'is true when sent less than one minute ago' do + user = build_stubbed(:user, reset_password_sent_at: Time.now) + + expect(user.recently_sent_password_reset?).to eq true + end + end + describe '#disable_two_factor!' do it 'clears all 2FA-related fields' do user = create(:user, :two_factor) |