diff options
author | Sean McGivern <sean@gitlab.com> | 2018-11-19 13:02:21 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-11-19 13:02:21 +0300 |
commit | 07d10976d2d46067b7ac05e36fb445781a1c6f37 (patch) | |
tree | 6714d4e6edaff0bc47315f050e6998915df0b401 /spec | |
parent | 7548c4d5af9198dd81adf751b41b15e9c8e5349c (diff) | |
parent | 94d518f5d68b9bcead7564b6f8d42047cdf5d23b (diff) |
Merge branch '54093-the-default_value_for-gem-doesn-t-handle-actioncontroller-parameters-correctly' into 'master'
Replace the `default_value_for` gem with the `gitlab-default_value_with` gem which handles `ActionController::Parameters` correctly
Closes #54093
See merge request gitlab-org/gitlab-ce!23114
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 18 | ||||
-rw-r--r-- | spec/services/users/build_service_spec.rb | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index d32f33ca1e2..f7c7a257075 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -130,7 +130,7 @@ describe "Admin::Users" 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@') + stub_application_setting(user_default_internal_regex: '\.internal@') visit new_admin_user_path end @@ -169,6 +169,22 @@ describe "Admin::Users" do expects_warning_to_be_hidden end + + it 'creates an internal user' do + user_name = 'tester1' + fill_in 'user_email', with: 'test.internal@domain.ch' + fill_in 'user_name', with: 'tester1 name' + fill_in 'user_username', with: user_name + + expects_external_to_be_unchecked + expects_warning_to_be_shown + + click_button 'Create user' + + new_user = User.find_by(username: user_name) + + expect(new_user.external).to be_falsy + end end end end diff --git a/spec/services/users/build_service_spec.rb b/spec/services/users/build_service_spec.rb index 17bc880dec5..b7b9817efdb 100644 --- a/spec/services/users/build_service_spec.rb +++ b/spec/services/users/build_service_spec.rb @@ -8,7 +8,7 @@ describe Users::BuildService do context 'with an admin user' do let(:admin_user) { create(:admin) } - let(:service) { described_class.new(admin_user, params) } + let(:service) { described_class.new(admin_user, ActionController::Parameters.new(params).permit!) } it 'returns a valid user' do expect(service.execute).to be_valid |