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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 16:16:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 16:16:36 +0300
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/controllers/confirmations_controller_spec.rb
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/controllers/confirmations_controller_spec.rb')
-rw-r--r--spec/controllers/confirmations_controller_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/controllers/confirmations_controller_spec.rb b/spec/controllers/confirmations_controller_spec.rb
index 401ee36b387..1c7f8de32bb 100644
--- a/spec/controllers/confirmations_controller_spec.rb
+++ b/spec/controllers/confirmations_controller_spec.rb
@@ -123,4 +123,45 @@ RSpec.describe ConfirmationsController do
end
end
end
+
+ describe '#create' do
+ let(:user) { create(:user) }
+
+ subject(:perform_request) { post(:create, params: { user: { email: user.email } }) }
+
+ context 'when reCAPTCHA is disabled' do
+ before do
+ stub_application_setting(recaptcha_enabled: false)
+ end
+
+ it 'successfully sends password reset when reCAPTCHA is not solved' do
+ perform_request
+
+ expect(response).to redirect_to(dashboard_projects_path)
+ end
+ end
+
+ context 'when reCAPTCHA is enabled' do
+ before do
+ stub_application_setting(recaptcha_enabled: true)
+ end
+
+ it 'displays an error when the reCAPTCHA is not solved' do
+ Recaptcha.configuration.skip_verify_env.delete('test')
+
+ perform_request
+
+ expect(response).to render_template(:new)
+ expect(flash[:alert]).to include 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'
+ end
+
+ it 'successfully sends password reset when reCAPTCHA is solved' do
+ Recaptcha.configuration.skip_verify_env << 'test'
+
+ perform_request
+
+ expect(response).to redirect_to(dashboard_projects_path)
+ end
+ end
+ end
end