BigW Consortium Gitlab

Commit 008f22cd by Grzegorz Bizon

Fix pipeline specs related to canceling builds

parent 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,7 +547,13 @@ describe Ci::Pipeline, models: true do ...@@ -545,7 +547,13 @@ describe Ci::Pipeline, models: true do
build.cancel build.cancel
end 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 end
context 'on failure and build retry' do 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