diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-07-25 16:44:02 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-07-25 16:49:26 +0800 |
commit | 25e44edc30b5ca61267487248db9330da3e48a6c (patch) | |
tree | aed26c4fb1e0ac1fc9dd76d64bcf16318a49ba42 /spec/requests | |
parent | d95e6da0d582cd4b0d333b3b6a1bfa3a565b874e (diff) | |
download | gitlab-ce-25e44edc30b5ca61267487248db9330da3e48a6c.tar.gz |
Allow admin to read_users_list even if it's restricted
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/users_spec.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 877bde3b9a6..66b165b438b 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -55,17 +55,22 @@ describe API::Users do context "when public level is restricted" do before do stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) - allow_any_instance_of(API::Helpers).to receive(:authenticate!).and_return(true) end - it "renders 403" do - get api("/users") - expect(response).to have_http_status(403) + context 'when authenticate as a regular user' do + it "renders 403" do + get api("/users", user) + + expect(response).to have_gitlab_http_status(403) + end end - it "renders 404" do - get api("/users/#{user.id}") - expect(response).to have_http_status(404) + context 'when authenticate as an admin' do + it "renders 200" do + get api("/users", admin) + + expect(response).to have_gitlab_http_status(200) + end end end |