Commit 92a83aae authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add a test for Ci::Pipeline#cancel_running:

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7508#note_18622559

I didn't write an exhaustive one because we already have it on
HasStatus, from:

https://gitlab.com/gitlab-org/gitlab-ce/commit/b6a7a4783435a7fa34f26dbf3b16ab8e7ed21b88
parent b6a7a478
...@@ -454,6 +454,22 @@ describe Ci::Pipeline, models: true do ...@@ -454,6 +454,22 @@ describe Ci::Pipeline, models: true do
end end
end end
describe '#cancel_running' do
context 'when there is a running external job and created build' do
before do
create(:generic_commit_status, :running, pipeline: pipeline)
create(:ci_build, :created, pipeline: pipeline)
pipeline.cancel_running
end
it 'cancels both jobs' do
expect(pipeline.statuses.pluck(:status)).
to contain_exactly('canceled', 'canceled')
end
end
end
describe '#execute_hooks' do describe '#execute_hooks' do
let!(:build_a) { create_build('a', 0) } let!(:build_a) { create_build('a', 0) }
let!(:build_b) { create_build('b', 1) } let!(:build_b) { create_build('b', 1) }
......
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