Commit c2e2cde9 authored by Borja Aparicio's avatar Borja Aparicio

Added API spec test for projects/owned endpoint

parent 55e0065b
...@@ -175,6 +175,30 @@ describe API::API, api: true do ...@@ -175,6 +175,30 @@ describe API::API, api: true do
end end
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 describe 'GET /projects/visible' do
let(:public_project) { create(:project, :public) } let(:public_project) { create(:project, :public) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment