Treat "" as nil for external commit status description
This commit is contained in:
parent
ffc9fe49a1
commit
7f6e0c84f8
|
@ -6,7 +6,7 @@ module Gitlab
|
||||||
module External
|
module External
|
||||||
module Common
|
module Common
|
||||||
def label
|
def label
|
||||||
subject.description || super
|
subject.description.presence || super
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_details?
|
def has_details?
|
||||||
|
|
|
@ -21,13 +21,21 @@ describe Gitlab::Ci::Status::External::Common do
|
||||||
expect(subject.label).to eq external_description
|
expect(subject.label).to eq external_description
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when description is not set' do
|
context 'when description is nil' do
|
||||||
let(:external_description) { nil }
|
let(:external_description) { nil }
|
||||||
|
|
||||||
it 'uses core status label' do
|
it 'uses core status label' do
|
||||||
expect(subject.label).to eq('passed')
|
expect(subject.label).to eq('passed')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when description is empty string' do
|
||||||
|
let(:external_description) { '' }
|
||||||
|
|
||||||
|
it 'uses core status label' do
|
||||||
|
expect(subject.label).to eq('passed')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#has_action?' do
|
describe '#has_action?' do
|
||||||
|
|
Loading…
Reference in New Issue