Render canceled status if any of the jobs canceled
This status will be returned only when there are no failed jobs that are not allowed to fail.
This commit is contained in:
parent
c01ff1f54b
commit
bdb86ea6cf
2 changed files with 27 additions and 1 deletions
|
@ -18,7 +18,7 @@ module Statuseable
|
|||
WHEN (#{builds})=0 THEN NULL
|
||||
WHEN (#{builds})=(#{success})+(#{ignored}) THEN 'success'
|
||||
WHEN (#{builds})=(#{pending}) THEN 'pending'
|
||||
WHEN (#{builds})=(#{canceled}) THEN 'canceled'
|
||||
WHEN (#{builds})=(#{canceled})+(#{success})+(#{ignored}) THEN 'canceled'
|
||||
WHEN (#{builds})=(#{skipped}) THEN 'skipped'
|
||||
WHEN (#{running})+(#{pending})>0 THEN 'running'
|
||||
ELSE 'failed'
|
||||
|
|
|
@ -61,9 +61,35 @@ describe Statuseable do
|
|||
let(:statuses) do
|
||||
[create(type, status: :success), create(type, status: :canceled)]
|
||||
end
|
||||
|
||||
it { is_expected.to eq 'canceled' }
|
||||
end
|
||||
|
||||
context 'one failed and one canceled' do
|
||||
let(:statuses) do
|
||||
[create(type, status: :failed), create(type, status: :canceled)]
|
||||
end
|
||||
|
||||
it { is_expected.to eq 'failed' }
|
||||
end
|
||||
|
||||
context 'one failed but allowed to fail and one canceled' do
|
||||
let(:statuses) do
|
||||
[create(type, status: :failed, allow_failure: true),
|
||||
create(type, status: :canceled)]
|
||||
end
|
||||
|
||||
it { is_expected.to eq 'canceled' }
|
||||
end
|
||||
|
||||
context 'one running one canceled' do
|
||||
let(:statuses) do
|
||||
[create(type, status: :running), create(type, status: :canceled)]
|
||||
end
|
||||
|
||||
it { is_expected.to eq 'running' }
|
||||
end
|
||||
|
||||
context 'all canceled' do
|
||||
let(:statuses) do
|
||||
[create(type, status: :canceled), create(type, status: :canceled)]
|
||||
|
|
Loading…
Reference in a new issue