diff options
author | Matija Čupić <matteeyah@gmail.com> | 2019-07-17 01:36:49 +0200 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2019-07-23 12:02:07 +0200 |
commit | 41b8dca877ba790cd56677dc6405e16b631f9854 (patch) | |
tree | 4d76c25f84ebb75b3a62f086ea559921b6f290b9 /spec/requests | |
parent | 4e814c257b74ac78a50f54ec57b1e1c7f78d43b7 (diff) | |
download | gitlab-ce-41b8dca877ba790cd56677dc6405e16b631f9854.tar.gz |
Add specs for specifying pipeline behavior
Adds specs for testing the new behavior of specifying a pipeline when
POSTing a status.
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/commit_statuses_spec.rb | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/requests/api/commit_statuses_spec.rb b/spec/requests/api/commit_statuses_spec.rb index b5e45f99109..1be8883bd3c 100644 --- a/spec/requests/api/commit_statuses_spec.rb +++ b/spec/requests/api/commit_statuses_spec.rb @@ -8,10 +8,6 @@ describe API::CommitStatuses do let(:developer) { create_user(:developer) } let(:sha) { commit.id } - let(:commit_status) do - create(:commit_status, status: :pending, pipeline: pipeline) - end - describe "GET /projects/:id/repository/commits/:sha/statuses" do let(:get_url) { "/projects/#{project.id}/repository/commits/#{sha}/statuses" } @@ -239,6 +235,26 @@ describe API::CommitStatuses do expect(CommitStatus.count).to eq 1 end end + + context 'when a pipeline id is specified' do + let!(:first_pipeline) { project.ci_pipelines.create(source: :push, sha: commit.id, ref: 'master', status: 'created') } + let!(:other_pipeline) { project.ci_pipelines.create(source: :push, sha: commit.id, ref: 'master', status: 'created') } + + subject do + post api(post_url, developer), params: { + pipeline_id: other_pipeline.id, + state: 'success', + ref: 'master' + } + end + + it 'update the correct pipeline' do + subject + + expect(first_pipeline.reload.status).to eq('created') + expect(other_pipeline.reload.status).to eq('success') + end + end end context 'when retrying a commit status' do |