Commit 143d64fc authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'mo-fix-codequality-base-report' into 'master'

Fix codequality empty base report

See merge request gitlab-org/gitlab!54584
parents 717304f1 8aadc080
......@@ -8,6 +8,7 @@ module Gitlab
STATUS_SUCCESS = 'success'
STATUS_FAILED = 'failed'
STATUS_NOT_FOUND = 'not_found'
attr_reader :base_report, :head_report
......@@ -17,7 +18,13 @@ module Gitlab
end
def status
success? ? STATUS_SUCCESS : STATUS_FAILED
if success?
STATUS_SUCCESS
elsif base_report.nil? || head_report.nil?
STATUS_NOT_FOUND
else
STATUS_FAILED
end
end
def success?
......
......@@ -45,6 +45,30 @@ RSpec.describe Gitlab::Ci::Reports::ReportsComparer do
expect(status).to eq('failed')
end
end
context 'when base_report is nil' do
let(:base_report) { nil }
before do
allow(comparer).to receive(:success?).and_return(false)
end
it 'returns status not_found' do
expect(status).to eq('not_found')
end
end
context 'when head_report is nil' do
let(:head_report) { nil }
before do
allow(comparer).to receive(:success?).and_return(false)
end
it 'returns status not_found' do
expect(status).to eq('not_found')
end
end
end
describe '#success?' do
......
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