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>2020-01-13 09:08:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-13 09:08:10 +0300
commit6ede90f5dd63d4a1f5ba243b4ed5097bb1a0acab (patch)
tree6bb9e934cdd90d62e672a1d6c4a5a63995bfbb00 /spec/controllers/profiles_controller_spec.rb
parentb8e30b446d9cb91b94d2b55e5c81303c8f2d1b25 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/profiles_controller_spec.rb')
-rw-r--r--spec/controllers/profiles_controller_spec.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb
index 265f941e146..85b3ba286a1 100644
--- a/spec/controllers/profiles_controller_spec.rb
+++ b/spec/controllers/profiles_controller_spec.rb
@@ -81,6 +81,54 @@ describe ProfilesController, :request_store do
expect(ldap_user.location).to eq('City, Country')
end
+ context 'updating name' do
+ subject { put :update, params: { user: { name: 'New Name' } } }
+
+ context 'when the ability to update thier name is not disabled for users' do
+ before do
+ stub_application_setting(updating_name_disabled_for_users: false)
+ sign_in(user)
+ end
+
+ it 'updates the name' do
+ subject
+
+ expect(response.status).to eq(302)
+ expect(user.reload.name).to eq('New Name')
+ end
+ end
+
+ 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
+
+ context 'as a regular user' do
+ it 'does not update the name' do
+ sign_in(user)
+
+ subject
+
+ expect(response.status).to eq(302)
+ expect(user.reload.name).not_to eq('New Name')
+ end
+ end
+
+ context 'as an admin user' do
+ it 'updates the name' do
+ admin = create(:admin)
+
+ sign_in(admin)
+
+ subject
+
+ expect(response.status).to eq(302)
+ expect(admin.reload.name).to eq('New Name')
+ end
+ end
+ end
+ end
+
it 'allows setting a user status' do
sign_in(user)