diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-10-26 14:02:20 +0800 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-19 23:59:54 +0800 |
commit | 2ec2a906b552d5f4a486130b88a39a4a14e7b28f (patch) | |
tree | 83e3041d67bd267edd0a68677bad3752bf4d4fc5 /spec/requests/api/groups_spec.rb | |
parent | 08ddb655ef461c57355eeb83edf10988decb2ced (diff) | |
download | gitlab-ce-2ec2a906b552d5f4a486130b88a39a4a14e7b28f.tar.gz |
Add group projects API options for including shared and subgroups
Diffstat (limited to 'spec/requests/api/groups_spec.rb')
-rw-r--r-- | spec/requests/api/groups_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 3802b5c6848..fe47d23ad3c 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -502,6 +502,32 @@ describe API::Groups do expect(json_response.first['name']).to eq(public_project.name) end + it 'returns projects excluding shared' do + create(:project_group_link, project: create(:project), group: group1) + create(:project_group_link, project: create(:project), group: group1) + create(:project_group_link, project: create(:project), group: group1) + + get api("/groups/#{group1.id}/projects", user1), include_shared: false + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an(Array) + expect(json_response.length).to eq(2) + end + + it 'returns projects including those in subgroups' do + subgroup = create(:group, parent: group1) + create(:project, group: subgroup) + create(:project, group: subgroup) + + get api("/groups/#{group1.id}/projects", user1), include_subgroups: true + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an(Array) + expect(json_response.length).to eq(4) + end + it "does not return a non existing group" do get api("/groups/1328/projects", user1) |