diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-23 00:10:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-23 00:10:35 +0300 |
commit | ebaefcebccee0575e8dddde1fe17dabaae62459b (patch) | |
tree | 286bf98e899eb48a0b2a4bbd6f0c506f6409b5a2 /spec/requests | |
parent | 39cc8695fc20e17f4989fa99aa9fafc00f9e2953 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 4f84e6f2562..332dc938833 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -1504,6 +1504,20 @@ RSpec.describe API::Projects do expect(json_response.map { |project| project['id'] }).to contain_exactly(private_project1.id) end + context 'and using an admin to search', :enable_admin_mode, :aggregate_errors do + it 'returns users projects when authenticated as admin' do + private_project1 = create(:project, :private, name: 'private_project1', creator_id: user4.id, namespace: user4.namespace) + + # min_access_level does not make any difference when admins search for a user's projects + get api("/users/#{user4.id}/projects/", admin), params: { min_access_level: 30 } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(json_response.map { |project| project['id'] }).to contain_exactly(project4.id, private_project1.id, public_project.id) + end + end + context 'and using the programming language filter' do include_context 'with language detection' |