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
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-08-11 18:46:17 +0300
committerSean McGivern <sean@mcgivern.me.uk>2017-08-11 18:46:17 +0300
commit0887a2bd10c3d774299b5b779d0335ddcb5064de (patch)
treec9653af3aac17c7ea9be9a78aeb8e251fef75395 /spec
parent3f18ea1ea964a1214814692ec980435a9cb22ff6 (diff)
parent09a348eb139178be534d181273a360a3125df9f9 (diff)
Merge branch '36213-return-is_admin-in-users-api-when-current_user-is-admin' into 'master'
Include the `is_admin` field in the `GET /users/:id` API when current user is an admin Closes #36213 See merge request !13501
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/users_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 2dc7be22f8f..49739a1601a 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -217,9 +217,19 @@ describe API::Users do
it "does not return the user's `is_admin` flag" do
get api("/users/#{user.id}", user)
+ expect(response).to have_http_status(200)
expect(json_response['is_admin']).to be_nil
end
+ context 'when authenticated as admin' do
+ it 'includes the `is_admin` field' do
+ get api("/users/#{user.id}", admin)
+
+ expect(response).to have_http_status(200)
+ expect(json_response['is_admin']).to be(false)
+ end
+ end
+
context 'for an anonymous user' do
it "returns a user by id" do
get api("/users/#{user.id}")