diff options
Diffstat (limited to 'spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb b/spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb index 08a3fbd7867..45e87466532 100644 --- a/spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb +++ b/spec/lib/gitlab/ci/parsers/coverage/cobertura_spec.rb @@ -19,6 +19,41 @@ RSpec.describe Gitlab::Ci::Parsers::Coverage::Cobertura do end end + context 'when there is a <sources>' do + shared_examples_for 'ignoring sources' do + it 'parses XML without errors' do + expect { subject }.not_to raise_error + + expect(coverage_report.files).to eq({}) + end + end + + context 'and has a single source' do + let(:cobertura) do + <<-EOF.strip_heredoc + <sources> + <source>project/src</source> + </sources> + EOF + end + + it_behaves_like 'ignoring sources' + end + + context 'and has multiple sources' do + let(:cobertura) do + <<-EOF.strip_heredoc + <sources> + <source>project/src/foo</source> + <source>project/src/bar</source> + </sources> + EOF + end + + it_behaves_like 'ignoring sources' + end + end + context 'when there is a single <class>' do context 'with no lines' do let(:cobertura) do |