summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-10-04 17:46:08 +0100
committerSean McGivern <sean@gitlab.com>2016-10-04 17:46:08 +0100
commit42cb659726822d500086ce09f712b858228f4caa (patch)
treeaea754187888f682d9bf927242234578627147c1 /spec/requests
parent355f97f8c321e815b245021488ae4a2a5aa6c2c3 (diff)
downloadgitlab-ce-42cb659726822d500086ce09f712b858228f4caa.tar.gz
Update API docs and specs for /projects/visible
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/projects_spec.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 5bf8b64b84b..fafceb6ecfa 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -178,11 +178,30 @@ describe API::API, api: true do
describe 'GET /projects/visible' do
let(:public_project) { create(:project, :public) }
+ before do
+ public_project
+ project
+ project2
+ project3
+ project4
+ end
+
it 'returns the projects viewable by the user' do
- get api('/projects/visible', user3)
+ get api('/projects/visible', user)
+
+ expect(response).to have_http_status(200)
+ expect(json_response).to be_an Array
+ expect(json_response.map { |project| project['id'] }).
+ to contain_exactly(public_project.id, project.id, project2.id, project3.id)
+ end
+
+ it 'shows only public projects when the user only has access to those' do
+ get api('/projects/visible', user2)
+
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
- expect(json_response.map { |project| project['id'] }).to contain_exactly(project.id, project2.id, project4.id)
+ expect(json_response.map { |project| project['id'] }).
+ to contain_exactly(public_project.id)
end
end