rodjek / rspec-puppet

RSpec tests for your Puppet manifests
http://rspec-puppet.com
MIT License
364 stars 203 forks source link

Coverage report fails when there are 0 resources #803

Open raemer opened 4 years ago

raemer commented 4 years ago

Hi,

while writing tests for a provider with coverage reports on, I noticed this behavior: If there are no resources, this is detected correctly as "Total resources: 0, Touched resources: 0", but the resources coverage is NaN%. The code coverage check then fails:

expected: >= 100.0
got:    0.0

As the test doesn't really have a meaning if there are no resources, I implemented a check if the total is zero, setting the coverage to 100% if so and opened pull request #802 . Though 100% is as wrong as 0%, it seems to be more useful as it does not generate meaningless failed tests.

Best regards, Jan-Martin