Commit 3e481f15 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add metadata and template methods for coverage badge

parent dbb9d6a7
...@@ -29,6 +29,14 @@ module Gitlab ...@@ -29,6 +29,14 @@ module Gitlab
@coverage.to_i @coverage.to_i
end end
def metadata
@metadata ||= Coverage::Metadata.new(self)
end
def template
@template ||= Coverage::Template.new(self)
end
private private
def raw_coverage def raw_coverage
......
...@@ -14,6 +14,18 @@ describe Gitlab::Badge::Coverage::Report do ...@@ -14,6 +14,18 @@ describe Gitlab::Badge::Coverage::Report do
end end
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 shared_examples 'unknown coverage report' do
context 'particular job specified' do context 'particular job specified' do
let(:job_name) { '' } let(:job_name) { '' }
......
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