diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-13 06:08:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-13 06:08:10 +0000 |
commit | 6ede90f5dd63d4a1f5ba243b4ed5097bb1a0acab (patch) | |
tree | 6bb9e934cdd90d62e672a1d6c4a5a63995bfbb00 /spec/controllers/admin | |
parent | b8e30b446d9cb91b94d2b55e5c81303c8f2d1b25 (diff) | |
download | gitlab-ce-6ede90f5dd63d4a1f5ba243b4ed5097bb1a0acab.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/admin')
-rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 7 | ||||
-rw-r--r-- | spec/controllers/admin/users_controller_spec.rb | 22 |
2 files changed, 29 insertions, 0 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index fa575ba2eae..e2bded3f176 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -102,6 +102,13 @@ describe Admin::ApplicationSettingsController do expect(ApplicationSetting.current.minimum_password_length).to eq(10) end + it 'updates updating_name_disabled_for_users setting' do + put :update, params: { application_setting: { updating_name_disabled_for_users: true } } + + expect(response).to redirect_to(admin_application_settings_path) + expect(ApplicationSetting.current.updating_name_disabled_for_users).to eq(true) + end + context 'external policy classification settings' do let(:settings) do { diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index ebdfbe14dec..54ba7a6fb6c 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -257,6 +257,28 @@ describe Admin::UsersController do end describe 'POST update' do + context 'updating name' do + context 'when the ability to update their name is disabled for users' do + before do + stub_application_setting(updating_name_disabled_for_users: true) + end + + it 'updates the name' do + params = { + id: user.to_param, + user: { + name: 'New Name' + } + } + + put :update, params: params + + expect(response).to redirect_to(admin_user_path(user)) + expect(user.reload.name).to eq('New Name') + end + end + end + context 'when the password has changed' do def update_password(user, password, password_confirmation = nil) params = { |