summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorBorja Aparicio <borja.aparicio.cotarelo@cern.ch>2016-10-25 14:54:18 +0200
committerBorja Aparicio <borja.aparicio.cotarelo@cern.ch>2016-11-08 10:44:07 +0100
commitc2e2cde910008e148c0af49ee6135be0b3d7f7d9 (patch)
treed3ff05f518796c00517cc2bfff804478052f7c64 /spec
parent55e0065b49d63f53c40876196d8f110e4eb3ea32 (diff)
downloadgitlab-ce-c2e2cde910008e148c0af49ee6135be0b3d7f7d9.tar.gz
Added API spec test for projects/owned endpoint
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/projects_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 3c8f0ac531a..d6e9fd2c4b2 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -175,6 +175,30 @@ describe API::API, api: true do
end
end
+ describe 'GET /projects/owned' do
+ before do
+ project3
+ project4
+ end
+
+ context 'when unauthenticated' do
+ it 'returns authentication error' do
+ get api('/projects/owned')
+ expect(response).to have_http_status(401)
+ end
+ end
+
+ context 'when authenticated as project owner' do
+ it 'returns an array of projects the user owns' do
+ get api('/projects/owned', user4)
+ expect(response).to have_http_status(200)
+ expect(json_response).to be_an Array
+ expect(json_response.first['name']).to eq(project4.name)
+ expect(json_response.first['owner']['username']).to eq(user4.username)
+ end
+ end
+ end
+
describe 'GET /projects/visible' do
let(:public_project) { create(:project, :public) }