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

Fix pipeline specs related to canceling builds

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