Commit 008f22cd authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix pipeline specs related to canceling builds

parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment