diff options
-rw-r--r-- | lib/gitlab/badge/coverage/report.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/badge/coverage/report_spec.rb | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab/badge/coverage/report.rb b/lib/gitlab/badge/coverage/report.rb index f06142003e3..3d56ea3e47a 100644 --- a/lib/gitlab/badge/coverage/report.rb +++ b/lib/gitlab/badge/coverage/report.rb @@ -29,6 +29,14 @@ module Gitlab @coverage.to_i end + def metadata + @metadata ||= Coverage::Metadata.new(self) + end + + def template + @template ||= Coverage::Template.new(self) + end + private def raw_coverage diff --git a/spec/lib/gitlab/badge/coverage/report_spec.rb b/spec/lib/gitlab/badge/coverage/report_spec.rb index 46b14873ee9..1ff49602486 100644 --- a/spec/lib/gitlab/badge/coverage/report_spec.rb +++ b/spec/lib/gitlab/badge/coverage/report_spec.rb @@ -14,6 +14,18 @@ describe Gitlab::Badge::Coverage::Report do end end + describe '#metadata' do + it 'returns correct metadata' do + expect(badge.metadata.image_url).to include 'coverage.svg' + end + end + + describe '#template' do + it 'returns correct template' do + expect(badge.template.key_text).to eq 'coverage' + end + end + shared_examples 'unknown coverage report' do context 'particular job specified' do let(:job_name) { '' } |