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
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-05-15 02:23:40 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-05-15 02:23:40 +0300
commit8e51c481b6a78cf34b4403d32111b15694adab2d (patch)
treea2d39eaf5c8abffbb34af96424589bce6e35c5ab /spec/models
parentefd7b57b3fb369b65bea477a3e3cbfa9db1449c9 (diff)
Does not log failed sign-in attempts when database is in read-only mode
Diffstat (limited to 'spec/models')
-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