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