diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-02 14:37:07 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-02 14:37:07 +0000 |
commit | 93522e59eccd8fd5801f313b34fec6a4f6394d9a (patch) | |
tree | bb7bceb68b7b0159ddf6926f240ace561bb13062 /spec/models/user_spec.rb | |
parent | c867c225095319684ad6ff396e4194bb1b5920d5 (diff) | |
parent | d40dd5cfe331c5e465b77c8eecae9697c873a67a (diff) | |
download | gitlab-ce-93522e59eccd8fd5801f313b34fec6a4f6394d9a.tar.gz |
Merge branch 'rs-throttle-reset' into 'master'
Throttle "Forgot your password?" emails
Addresses internal https://dev.gitlab.org/gitlab/gitlabhq/issues/2611
See merge request !1476
Diffstat (limited to 'spec/models/user_spec.rb')
-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 b7b525bfca2..c71cfb3ebe3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -228,6 +228,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) |