Skip to content
Snippets Groups Projects

Add auto-cancel for pending pipelines on branch, if they are not HEAD

1 file
+ 3
7
Compare changes
  • Side-by-side
  • Inline
@@ -18,19 +18,15 @@ def execute_service(after: project.commit.id, message: 'Message', ref: 'refs/hea
described_class.new(project, user, params).execute
end
shared_examples 'a pending pipeline' do
context 'valid params' do
let(:pipeline) { execute_service }
it { expect(pipeline).to be_kind_of(Ci::Pipeline) }
it { expect(pipeline).to be_valid }
it { expect(pipeline).to eq(project.pipelines.last) }
it { expect(pipeline).to have_attributes(user: user) }
it { expect(pipeline).to have_attributes(status: 'pending') }
it { expect(pipeline.builds.first).to be_kind_of(Ci::Build) }
end
context 'valid params' do
let(:pipeline) { execute_service }
it_behaves_like 'a pending pipeline'
context 'auto-cancel enabled' do
let(:pipeline_on_previous_commit) do
@@ -133,7+129,7 @@
before do
allow_any_instance_of(Ci::Pipeline).to receive(:git_commit_message) { message }
end
it_behaves_like 'a failed pipeline'
end
end
Loading