Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't add empty classes #18

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/simplecov-cobertura.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def result_to_xml(result)
end

groups.map do |name, files|
next if files.empty?
packages.add_element(package = REXML::Element.new('package'))
set_package_attributes(package, name, files)

Expand Down
9 changes: 8 additions & 1 deletion test/simplecov-cobertura_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

class CoberturaFormatterTest < Test::Unit::TestCase
def setup
@result = SimpleCov::Result.new({ "#{__FILE__}" => [1,2] })
coverage_data =
if Gem.loaded_specs['simplecov'].version >= Gem::Version.new('0.18')
{ lines: [1, 2] }
else
[1, 2]
end
@result = SimpleCov::Result.new({ __FILE__ => coverage_data })
@formatter = SimpleCov::Formatter::CoberturaFormatter.new
end

Expand Down Expand Up @@ -136,6 +142,7 @@ def test_groups
end

def test_supports_root_project_path
pend 'Creating files at `/` is not permitted in CI'
old_root = SimpleCov.root
SimpleCov.root('/')
expected_base = old_root[1..-1] # Remove leading "/"
Expand Down