diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/controllers/registrations_controller_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/controllers/registrations_controller_spec.rb')
-rw-r--r-- | spec/controllers/registrations_controller_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 70d4559edc1..637c774c38b 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -7,6 +7,7 @@ RSpec.describe RegistrationsController do before do stub_application_setting(require_admin_approval_after_user_signup: false) + stub_feature_flags(arkose_labs_signup_challenge: false) end describe '#new' do @@ -121,6 +122,7 @@ RSpec.describe RegistrationsController do context 'when `send_user_confirmation_email` is true' do before do stub_application_setting(send_user_confirmation_email: true) + stub_feature_flags(identity_verification: false) end it 'sends a confirmation email' do @@ -133,6 +135,10 @@ RSpec.describe RegistrationsController do end context 'email confirmation' do + before do + stub_feature_flags(identity_verification: false) + end + context 'when send_user_confirmation_email is false' do it 'signs the user in' do stub_application_setting(send_user_confirmation_email: false) @@ -492,6 +498,33 @@ RSpec.describe RegistrationsController do end end end + + context 'when the password is weak' do + render_views + let_it_be(:new_user_params) { { new_user: base_user_params.merge({ password: "password" }) } } + + subject { post(:create, params: new_user_params) } + + context 'when block_weak_passwords is enabled (default)' do + it 'renders the form with errors' do + expect { subject }.not_to change(User, :count) + + expect(controller.current_user).to be_nil + expect(response).to render_template(:new) + expect(response.body).to include(_('Password must not contain commonly used combinations of words and letters')) + end + end + + context 'when block_weak_passwords is disabled' do + before do + stub_feature_flags(block_weak_passwords: false) + end + + it 'permits weak passwords' do + expect { subject }.to change(User, :count).by(1) + end + end + end end describe '#destroy' do |