summaryrefslogtreecommitdiff
path: root/spec/models/concerns/has_status_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-06 13:54:29 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-06 13:54:29 +0100
commitcb4c9a03ce0035c1f56f56579e45447fa6bc96ee (patch)
treee186292fa4641b354762876c8eb5bda7b9f80dd0 /spec/models/concerns/has_status_spec.rb
parent80c463d9c1594c327e60829171e46c9d08b2f5ea (diff)
downloadgitlab-ce-cb4c9a03ce0035c1f56f56579e45447fa6bc96ee.tar.gz
Extend specs for code we use to calculate statuses
Diffstat (limited to 'spec/models/concerns/has_status_spec.rb')
-rw-r--r--spec/models/concerns/has_status_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/models/concerns/has_status_spec.rb b/spec/models/concerns/has_status_spec.rb
index dbfe3cd2d36..f134da441c2 100644
--- a/spec/models/concerns/has_status_spec.rb
+++ b/spec/models/concerns/has_status_spec.rb
@@ -109,6 +109,24 @@ describe HasStatus do
it { is_expected.to eq 'running' }
end
+
+ context 'when one status is a blocking manual action' do
+ let!(:statuses) do
+ [create(type, status: :failed),
+ create(type, status: :manual, allow_failure: false)]
+ end
+
+ it { is_expected.to eq 'manual' }
+ end
+
+ context 'when one status is a non-blocking manual action' do
+ let!(:statuses) do
+ [create(type, status: :failed),
+ create(type, status: :manual, allow_failure: true)]
+ end
+
+ it { is_expected.to eq 'failed' }
+ end
end
context 'ci build statuses' do
@@ -218,6 +236,18 @@ describe HasStatus do
it_behaves_like 'not containing the job', status
end
end
+
+ describe '.manual' do
+ subject { CommitStatus.manual }
+
+ %i[manual].each do |status|
+ it_behaves_like 'containing the job', status
+ end
+
+ %i[failed success skipped canceled].each do |status|
+ it_behaves_like 'not containing the job', status
+ end
+ end
end
describe '::DEFAULT_STATUS' do
@@ -225,4 +255,10 @@ describe HasStatus do
expect(described_class::DEFAULT_STATUS).to eq 'created'
end
end
+
+ describe '::BLOCKED_STATUS' do
+ it 'is a status manual' do
+ expect(described_class::BLOCKED_STATUS).to eq 'manual'
+ end
+ end
end