diff options
author | Roger Rüttimann <roger.ruettimann@gmail.com> | 2018-08-30 12:53:06 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-08-30 12:53:06 +0000 |
commit | 93b9bfd93a841b7f86e6aeab3f9c5e9ede3a4503 (patch) | |
tree | 8bfec898a33d9b0b1693e73ce27a61db54881a66 /spec/features/admin/admin_users_spec.rb | |
parent | 3113fb848001fdea3a039295002d7752b0feebbb (diff) | |
download | gitlab-ce-93b9bfd93a841b7f86e6aeab3f9c5e9ede3a4503.tar.gz |
Allow whitelisting for "external collaborator by default" setting
Diffstat (limited to 'spec/features/admin/admin_users_spec.rb')
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index b2eaeb1c487..d32f33ca1e2 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -125,6 +125,52 @@ describe "Admin::Users" do expect(page).to have_content('Username can contain only letters, digits') end end + + context 'with new users set to external enabled' do + context 'with regex to match internal user email address set', :js do + before do + stub_application_setting(user_default_external: true) + stub_application_setting(user_default_internal_regex: '.internal@') + + visit new_admin_user_path + end + + def expects_external_to_be_checked + expect(find('#user_external')).to be_checked + end + + def expects_external_to_be_unchecked + expect(find('#user_external')).not_to be_checked + end + + def expects_warning_to_be_hidden + expect(find('#warning_external_automatically_set', visible: :all)[:class]).to include 'hidden' + end + + def expects_warning_to_be_shown + expect(find('#warning_external_automatically_set')[:class]).not_to include 'hidden' + end + + it 'automatically unchecks external for matching email' do + expects_external_to_be_checked + expects_warning_to_be_hidden + + fill_in 'user_email', with: 'test.internal@domain.ch' + + expects_external_to_be_unchecked + expects_warning_to_be_shown + + fill_in 'user_email', with: 'test@domain.ch' + + expects_external_to_be_checked + expects_warning_to_be_hidden + + uncheck 'user_external' + + expects_warning_to_be_hidden + end + end + end end describe "GET /admin/users/:id" do |