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

Rename success to erased empty state spec

parent 00b45348
......@@ -2,7 +2,7 @@ module Gitlab
module Ci
module Status
module Build
class Success < Status::Extended
class Erased < Status::Extended
def illustration
{
image: 'illustrations/skipped-job_empty.svg',
......@@ -12,7 +12,7 @@ module Gitlab
end
def self.matches?(build, user)
!build.has_trace? && build.success?
build.erased?
end
end
end
......
......@@ -9,7 +9,7 @@ module Gitlab
Status::Build::Created,
Status::Build::Pending,
Status::Build::Skipped,
Status::Build::Success],
Status::Build::Erased],
[Status::Build::Cancelable,
Status::Build::Retryable],
[Status::Build::FailedAllowed,
......
require 'spec_helper'
describe Gitlab::Ci::Status::Build::Success do
describe Gitlab::Ci::Status::Build::Erased do
let(:user) { create(:user) }
subject do
......@@ -14,18 +14,16 @@ describe Gitlab::Ci::Status::Build::Success do
describe '.matches?' do
subject { described_class.matches?(build, user) }
context 'when build succeeded but does not have trace' do
let(:build) { create(:ci_build, :success) }
context 'when build is erased' do
let(:build) { create(:ci_build, :success, :erased) }
it 'is a correct match' do
build.erase
expect(subject).to be true
end
end
context 'when build succeed but has trace' do
let!(:build) { create(:ci_build, :success, :trace_artifact) }
context 'when build is not erased' do
let(:build) { create(:ci_build, :success, :trace_artifact) }
it 'does not match' do
expect(subject).to be false
......
......@@ -36,21 +36,32 @@ describe Gitlab::Ci::Status::Build::Factory do
expect(status).to have_details
expect(status).to have_action
end
end
context 'when job log gets erased' do
before do
build.erase
end
context 'when build is erased' do
let(:build) { create(:ci_build, :success, :erased) }
it 'matches correct extended statuses' do
expect(factory.extended_statuses)
.to eq [Gitlab::Ci::Status::Build::Success,
Gitlab::Ci::Status::Build::Retryable]
end
it 'matches correct core status' do
expect(factory.core_status).to be_a Gitlab::Ci::Status::Success
end
it 'fabricates a retryable build status' do
expect(status).to be_a Gitlab::Ci::Status::Build::Retryable
end
it 'matches correct extended statuses' do
expect(factory.extended_statuses)
.to eq [Gitlab::Ci::Status::Build::Erased,
Gitlab::Ci::Status::Build::Retryable]
end
it 'fabricates a retryable build status' do
expect(status).to be_a Gitlab::Ci::Status::Build::Retryable
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'passed'
expect(status.icon).to eq 'status_success'
expect(status.favicon).to eq 'favicon_status_success'
expect(status.label).to eq 'passed'
expect(status).to have_details
expect(status).to have_action
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