提交 008f22cd 编写于 作者: G Grzegorz Bizon

Fix pipeline specs related to canceling builds

上级 a70a83cf
......@@ -65,8 +65,8 @@ class CommitStatus < ActiveRecord::Base
end
event :cancel do
transition [:pending, :running] => :canceled
transition [:created] => :skipped
transition [:pending, :running] => :canceled
end
before_transition created: [:pending, :running] do |commit_status|
......
......@@ -503,7 +503,9 @@ describe Ci::Pipeline, models: true do
end
describe '#status' do
let!(:build) { create(:ci_build, :created, pipeline: pipeline, name: 'test') }
let(:build) do
create(:ci_build, :created, pipeline: pipeline, name: 'test')
end
subject { pipeline.reload.status }
......@@ -545,7 +547,13 @@ describe Ci::Pipeline, models: true do
build.cancel
end
it { is_expected.to eq('canceled') }
context 'when build is pending' do
let(:build) do
create(:ci_build, :pending, pipeline: pipeline)
end
it { is_expected.to eq('canceled') }
end
end
context 'on failure and build retry' do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册