Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-05-15 15:37:09 +0300
committerRémy Coutable <remy@rymai.me>2018-05-15 15:37:09 +0300
commit2df09a403ba4f97cce034032d0e03cb55a6b65be (patch)
treecaf09bad785391312d44b336cfe5571b08f3b81e /spec
parentf4ef6b474c44eb8e7034034dd95152818ae33b4a (diff)
parent80393f0f1c55124ffefc66f637b343386fdf1469 (diff)
Merge branch '46361-does-not-log-failed-sign-in-attempts-when-the-database-is-in-read-only-mode' into 'master'
Does not log failed sign-in attempts when the database is in read-only mode Closes #46361 See merge request gitlab-org/gitlab-ce!18957
Diffstat (limited to 'spec')
-rw-r--r--spec/models/user_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index ad094b3ed48..bb5308221f0 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -2755,4 +2755,18 @@ describe User do
it { is_expected.to be_truthy }
end
end
+
+ describe '#increment_failed_attempts!' do
+ subject(:user) { create(:user, failed_attempts: 0) }
+
+ it 'logs failed sign-in attempts' do
+ expect { user.increment_failed_attempts! }.to change(user, :failed_attempts).from(0).to(1)
+ end
+
+ it 'does not log failed sign-in attempts when in a GitLab read-only instance' do
+ allow(Gitlab::Database).to receive(:read_only?) { true }
+
+ expect { user.increment_failed_attempts! }.not_to change(user, :failed_attempts)
+ end
+ end
end