Commit d883fe1c authored by Matija Čupić's avatar Matija Čupić

Add success CI Build empty state status

parent 75f8a45f
......@@ -8,7 +8,8 @@ module Gitlab
Status::Build::Canceled,
Status::Build::Created,
Status::Build::Pending,
Status::Build::Skipped],
Status::Build::Skipped,
Status::Build::Success],
[Status::Build::Cancelable,
Status::Build::Retryable],
[Status::Build::FailedAllowed,
......
module Gitlab
module Ci
module Status
module Build
class Success < Status::Extended
def illustration
{
image: 'illustrations/skipped-job_empty.svg',
size: 'svg-430',
title: _('Job has been erased')
}
end
def self.matches?(build, user)
build.success?
end
end
end
end
end
end
......@@ -36,6 +36,22 @@ describe Gitlab::Ci::Status::Build::Factory do
expect(status).to have_details
expect(status).to have_action
end
context 'when job log gets erased' do
before do
build.trace.set(nil)
end
it 'matches correct extended statuses' do
expect(factory.extended_statuses)
.to eq [Gitlab::Ci::Status::Build::Success,
Gitlab::Ci::Status::Build::Retryable]
end
it 'fabricates a retryable build status' do
expect(status).to be_a Gitlab::Ci::Status::Build::Retryable
end
end
end
context 'when build is failed' do
......
require 'spec_helper'
describe Gitlab::Ci::Status::Build::Success do
let(:user) { create(:user) }
subject do
described_class.new(double('subject'))
end
describe '#illustration' do
it { expect(subject.illustration).to include(:image, :size, :title) }
end
describe '.matches?' do
subject {described_class.matches?(build, user) }
context 'when build succeeded' do
let(:build) { create(:ci_build, :success) }
it 'is a correct match' do
expect(subject).to be true
end
end
context 'when build did not succeed' do
let(:build) { create(:ci_build, :skipped) }
it 'does not match' do
expect(subject).to be false
end
end
end
end
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