diff options
Diffstat (limited to 'spec/lib/gitlab/badge')
-rw-r--r-- | spec/lib/gitlab/badge/coverage/template_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/badge/pipeline/status_spec.rb | 28 | ||||
-rw-r--r-- | spec/lib/gitlab/badge/pipeline/template_spec.rb | 4 |
3 files changed, 32 insertions, 4 deletions
diff --git a/spec/lib/gitlab/badge/coverage/template_spec.rb b/spec/lib/gitlab/badge/coverage/template_spec.rb index 5a0adfd8e59..ba5c1b2ce6e 100644 --- a/spec/lib/gitlab/badge/coverage/template_spec.rb +++ b/spec/lib/gitlab/badge/coverage/template_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Gitlab::Badge::Coverage::Template do context 'when its size is larger than the max allowed value' do before do - allow(badge).to receive(:customization).and_return({ key_text: 't' * 129 }) + allow(badge).to receive(:customization).and_return({ key_text: 't' * 65 }) end it 'returns default value' do @@ -76,7 +76,7 @@ RSpec.describe Gitlab::Badge::Coverage::Template do context 'when it is larger than the max allowed value' do before do - allow(badge).to receive(:customization).and_return({ key_width: 129 }) + allow(badge).to receive(:customization).and_return({ key_width: 513 }) end it 'returns default value' do diff --git a/spec/lib/gitlab/badge/pipeline/status_spec.rb b/spec/lib/gitlab/badge/pipeline/status_spec.rb index fcc0d4030fd..b5dabca0477 100644 --- a/spec/lib/gitlab/badge/pipeline/status_spec.rb +++ b/spec/lib/gitlab/badge/pipeline/status_spec.rb @@ -78,6 +78,34 @@ RSpec.describe Gitlab::Badge::Pipeline::Status do expect(badge.status).to eq 'success' end end + + context 'when ignored_skipped is set to true' do + let(:new_badge) { described_class.new(project, branch, opts: { ignore_skipped: true }) } + + before do + pipeline.skip! + end + + describe '#status' do + it 'uses latest non-skipped status' do + expect(new_badge.status).not_to eq 'skipped' + end + end + end + + context 'when ignored_skipped is set to false' do + let(:new_badge) { described_class.new(project, branch, opts: { ignore_skipped: false }) } + + before do + pipeline.skip! + end + + describe '#status' do + it 'uses latest status' do + expect(new_badge.status).to eq 'skipped' + end + end + end end context 'build does not exist' do diff --git a/spec/lib/gitlab/badge/pipeline/template_spec.rb b/spec/lib/gitlab/badge/pipeline/template_spec.rb index 2f0d0782369..c78e95852f3 100644 --- a/spec/lib/gitlab/badge/pipeline/template_spec.rb +++ b/spec/lib/gitlab/badge/pipeline/template_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Gitlab::Badge::Pipeline::Template do context 'when its size is larger than the max allowed value' do before do - allow(badge).to receive(:customization).and_return({ key_text: 't' * 129 }) + allow(badge).to receive(:customization).and_return({ key_text: 't' * 65 }) end it 'returns default value' do @@ -54,7 +54,7 @@ RSpec.describe Gitlab::Badge::Pipeline::Template do context 'when it is larger than the max allowed value' do before do - allow(badge).to receive(:customization).and_return({ key_width: 129 }) + allow(badge).to receive(:customization).and_return({ key_width: 513 }) end it 'returns default value' do |