diff options
author | Robert Speicher <robert@gitlab.com> | 2018-07-03 20:36:11 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-07-03 20:36:11 +0000 |
commit | 26998c68c936f183ead1a84e404a61160fc646f7 (patch) | |
tree | 8427f26f12a599a4e83271d0c381aa73b8c23520 /spec | |
parent | 88b2532984d09de16fb4aaea2eb8b28527125474 (diff) | |
parent | 7376ffc3a3f3d0f3bc294c4431370c5560c19a00 (diff) | |
download | gitlab-ce-26998c68c936f183ead1a84e404a61160fc646f7.tar.gz |
Merge branch 'sh-add-captcha-prometheus-counters' into 'master'
Add Prometheus metrics to track reCAPTCHA success/failures
See merge request gitlab-org/gitlab-ce!20086
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/sessions_controller_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index cdec26bd421..7c00652317b 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -93,6 +93,12 @@ describe SessionsController do it 'displays an error when the reCAPTCHA is not solved' do # Without this, `verify_recaptcha` arbitraily returns true in test env Recaptcha.configuration.skip_verify_env.delete('test') + counter = double(:counter) + + expect(counter).to receive(:increment) + expect(Gitlab::Metrics).to receive(:counter) + .with(:failed_login_captcha_total, anything) + .and_return(counter) post(:create, user: user_params) @@ -104,6 +110,13 @@ describe SessionsController do it 'successfully logs in a user when reCAPTCHA is solved' do # Avoid test ordering issue and ensure `verify_recaptcha` returns true Recaptcha.configuration.skip_verify_env << 'test' + counter = double(:counter) + + expect(counter).to receive(:increment) + expect(Gitlab::Metrics).to receive(:counter) + .with(:successful_login_captcha_total, anything) + .and_return(counter) + expect(Gitlab::Metrics).to receive(:counter).and_call_original post(:create, user: user_params) |