diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-17 15:23:58 +0200 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-18 16:56:39 +0200 |
commit | df5661b6f49d8a18db7fae6bda71f9dc733f5279 (patch) | |
tree | e1b95baace0ac1d7ffc4056d76e64addb1e47adf /spec/requests/api/pipelines_spec.rb | |
parent | de7b8e51b8b7b5bfaa72ee62a4eb08497cf69b4b (diff) | |
download | gitlab-ce-df5661b6f49d8a18db7fae6bda71f9dc733f5279.tar.gz |
Add docs on API for pipelines, plus minor fixeszj-pipelines-api-endpoints
Diffstat (limited to 'spec/requests/api/pipelines_spec.rb')
-rw-r--r-- | spec/requests/api/pipelines_spec.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index 40f54856712..7011bdc9ec0 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -12,9 +12,7 @@ describe API::API, api: true do ref: project.default_branch) end - before do - project.team << [user, :master] - end + before { project.team << [user, :master] } describe 'GET /projects/:id/pipelines ' do it_behaves_like 'a paginated resources' do @@ -28,6 +26,7 @@ describe API::API, api: true do expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.first['sha']).to match /\A\h{40}\z/ + expect(json_response.first['id']).to eq pipeline.id end end @@ -36,6 +35,8 @@ describe API::API, api: true do get api("/projects/#{project.id}/pipelines", non_member) expect(response).to have_http_status(404) + expect(json_response['message']).to eq '404 Project Not Found' + expect(json_response).not_to be_an Array end end end @@ -53,6 +54,8 @@ describe API::API, api: true do get api("/projects/#{project.id}/pipelines/123456", user) expect(response).to have_http_status(404) + expect(json_response['message']).to eq '404 Not found' + expect(json_response['id']).to be nil end end @@ -61,6 +64,8 @@ describe API::API, api: true do get api("/projects/#{project.id}/pipelines/#{pipeline.id}", non_member) expect(response).to have_http_status(404) + expect(json_response['message']).to eq '404 Project Not Found' + expect(json_response['id']).to be nil end end end @@ -80,6 +85,7 @@ describe API::API, api: true do end.to change { pipeline.builds.count }.from(1).to(2) expect(response).to have_http_status(201) + expect(build.reload.retried?).to be true end end @@ -88,6 +94,8 @@ describe API::API, api: true do post api("/projects/#{project.id}/pipelines/#{pipeline.id}/retry", non_member) expect(response).to have_http_status(404) + expect(json_response['message']).to eq '404 Project Not Found' + expect(json_response['id']).to be nil end end end @@ -118,6 +126,7 @@ describe API::API, api: true do post api("/projects/#{project.id}/pipelines/#{pipeline.id}/cancel", reporter) expect(response).to have_http_status(403) + expect(pipeline.reload.status).to eq('pending') end end end |