diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-09 11:11:42 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-13 15:11:21 +0100 |
commit | 008f22cd820a5bf9e8ff9a68550c9550463d3279 (patch) | |
tree | 20b1ee59cfeebf37e507fe4aa870d7b3c25e5206 | |
parent | a70a83cf290d12ec83b79e35fd5e92375216fc43 (diff) | |
download | gitlab-ce-008f22cd820a5bf9e8ff9a68550c9550463d3279.tar.gz |
Fix pipeline specs related to canceling builds
-rw-r--r-- | app/models/commit_status.rb | 2 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index e2ce5062f6f..4a064644d64 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -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| diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 426be74cd02..3be489c7c5c 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -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 |