summaryrefslogtreecommitdiff
path: root/spec/models/ci
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-21 17:59:57 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-11-21 18:30:24 +0800
commit1edb1746a51a19fae24c976c329e80a1dbd6062a (patch)
treefa2e92feafd4aebedc57fccf00fc0e22a4cee938 /spec/models/ci
parentca639c9b824d6c8effb620bc71255eb0895ab2cc (diff)
downloadgitlab-ce-1edb1746a51a19fae24c976c329e80a1dbd6062a.tar.gz
Prefer a description for it and split the case:
Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7508#note_18730091
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/pipeline_spec.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index af619a02ed9..29e5693d5ab 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -403,15 +403,15 @@ describe Ci::Pipeline, models: true do
end
describe '#cancelable?' do
- subject { pipeline.cancelable? }
-
%i[created running pending].each do |status|
context "when there is a build #{status}" do
before do
create(:ci_build, status, pipeline: pipeline)
end
- it { is_expected.to be_truthy }
+ it 'is cancelable' do
+ expect(pipeline.cancelable?).to be_truthy
+ end
end
context "when there is an external job #{status}" do
@@ -419,7 +419,9 @@ describe Ci::Pipeline, models: true do
create(:generic_commit_status, status, pipeline: pipeline)
end
- it { is_expected.to be_truthy }
+ it 'is cancelable' do
+ expect(pipeline.cancelable?).to be_truthy
+ end
end
%i[success failed canceled].each do |status2|
@@ -430,7 +432,9 @@ describe Ci::Pipeline, models: true do
create(build.sample, status2, pipeline: pipeline)
end
- it { is_expected.to be_truthy }
+ it 'is cancelable' do
+ expect(pipeline.cancelable?).to be_truthy
+ end
end
end
end
@@ -441,7 +445,9 @@ describe Ci::Pipeline, models: true do
create(:ci_build, status, pipeline: pipeline)
end
- it { is_expected.to be_falsey }
+ it 'is not cancelable' do
+ expect(pipeline.cancelable?).to be_falsey
+ end
end
context "when there is an external job #{status}" do
@@ -449,7 +455,9 @@ describe Ci::Pipeline, models: true do
create(:generic_commit_status, status, pipeline: pipeline)
end
- it { is_expected.to be_falsey }
+ it 'is not cancelable' do
+ expect(pipeline.cancelable?).to be_falsey
+ end
end
end
end