Commit 00b45348 authored by Matija Čupić's avatar Matija Čupić

Fix job setup in success empty state specs

parent d883fe1c
...@@ -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.success? !build.has_trace? && build.success?
end end
end end
end end
......
...@@ -13,7 +13,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -13,7 +13,7 @@ describe Gitlab::Ci::Status::Build::Factory do
end end
context 'when build is successful' do context 'when build is successful' do
let(:build) { create(:ci_build, :success) } let(:build) { create(:ci_build, :success, :trace_artifact) }
it 'matches correct core status' do it 'matches correct core status' do
expect(factory.core_status).to be_a Gitlab::Ci::Status::Success expect(factory.core_status).to be_a Gitlab::Ci::Status::Success
...@@ -39,7 +39,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -39,7 +39,7 @@ describe Gitlab::Ci::Status::Build::Factory do
context 'when job log gets erased' do context 'when job log gets erased' do
before do before do
build.trace.set(nil) build.erase
end end
it 'matches correct extended statuses' do it 'matches correct extended statuses' do
......
...@@ -12,18 +12,20 @@ describe Gitlab::Ci::Status::Build::Success do ...@@ -12,18 +12,20 @@ describe Gitlab::Ci::Status::Build::Success do
end end
describe '.matches?' do describe '.matches?' do
subject {described_class.matches?(build, user) } subject { described_class.matches?(build, user) }
context 'when build succeeded' do context 'when build succeeded but does not have trace' do
let(:build) { create(:ci_build, :success) } let(:build) { create(:ci_build, :success) }
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 did not succeed' do context 'when build succeed but has trace' do
let(:build) { create(:ci_build, :skipped) } 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
......
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