Commit bdb86ea6 authored by Grzegorz Bizon's avatar Grzegorz Bizon

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.
parent c01ff1f5
...@@ -18,7 +18,7 @@ module Statuseable ...@@ -18,7 +18,7 @@ module Statuseable
WHEN (#{builds})=0 THEN NULL WHEN (#{builds})=0 THEN NULL
WHEN (#{builds})=(#{success})+(#{ignored}) THEN 'success' WHEN (#{builds})=(#{success})+(#{ignored}) THEN 'success'
WHEN (#{builds})=(#{pending}) THEN 'pending' WHEN (#{builds})=(#{pending}) THEN 'pending'
WHEN (#{builds})=(#{canceled}) THEN 'canceled' WHEN (#{builds})=(#{canceled})+(#{success})+(#{ignored}) THEN 'canceled'
WHEN (#{builds})=(#{skipped}) THEN 'skipped' WHEN (#{builds})=(#{skipped}) THEN 'skipped'
WHEN (#{running})+(#{pending})>0 THEN 'running' WHEN (#{running})+(#{pending})>0 THEN 'running'
ELSE 'failed' ELSE 'failed'
......
...@@ -61,9 +61,35 @@ describe Statuseable do ...@@ -61,9 +61,35 @@ describe Statuseable do
let(:statuses) do let(:statuses) do
[create(type, status: :success), create(type, status: :canceled)] [create(type, status: :success), create(type, status: :canceled)]
end 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' } it { is_expected.to eq 'failed' }
end 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 context 'all canceled' do
let(:statuses) do let(:statuses) do
[create(type, status: :canceled), create(type, status: :canceled)] [create(type, status: :canceled), create(type, status: :canceled)]
......
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