提交 92a83aae 编写于 作者: L 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
上级 b6a7a478
......@@ -454,6 +454,22 @@ describe Ci::Pipeline, models: true do
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
let!(:build_a) { create_build('a', 0) }
let!(:build_b) { create_build('b', 1) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册