diff options
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r-- | spec/requests/api/users_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 84e1f95828a..f6ff2020c79 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -778,6 +778,12 @@ describe API::Users do expect(user.reload.external?).to be_truthy end + it "private profile is false by default" do + put api("/users/#{user.id}", admin), params: {} + + expect(user.reload.private_profile).to eq(false) + end + it "updates private profile" do put api("/users/#{user.id}", admin), params: { private_profile: true } @@ -785,14 +791,24 @@ describe API::Users do expect(user.reload.private_profile).to eq(true) end - it "updates private profile when nil is given to false" do - admin.update(private_profile: true) + it "updates private profile to false when nil is given" do + user.update(private_profile: true) put api("/users/#{user.id}", admin), params: { private_profile: nil } + expect(response).to have_gitlab_http_status(200) expect(user.reload.private_profile).to eq(false) end + it "does not modify private profile when field is not provided" do + user.update(private_profile: true) + + put api("/users/#{user.id}", admin), params: {} + + expect(response).to have_gitlab_http_status(200) + expect(user.reload.private_profile).to eq(true) + end + it "does not update admin status" do put api("/users/#{admin_user.id}", admin), params: { can_create_group: false } |