rodjek / rspec-puppet

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

Do not raise failure if nothing is tested #792

Closed Felixoid closed 4 years ago

Felixoid commented 4 years ago

RSpec::Puppet::Coverage.report!(percents) raises test failure if the total amount of tested puppet resources is 0. So either it annoys during ruby code development or should be mitigated with the following snippet in spec_helper.rb

RSpec.configure do |c|
  c.after(:suite) do
    RSpec::Puppet::Coverage.report!(94) unless RSpec::Puppet::Coverage.results[:total].zero?
  end
end

This PR implement checking of coverage only on total checked puppet resources greater than 0.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 85.469% when pulling cb91f2da187d66c00c731c3dda1c165f5fcb3577 on Felixoid:master into 6b29693ceddd1a71b2dae67fb8f266727d7f7608 on rodjek:master.

scotje commented 4 years ago

@Felixoid I'm wondering if #805 addressed this a different way now? (I think report[:coverage] should now be 100.00 if there are zero resources)

DavidS commented 4 years ago

Closing this as it has been addressed in a different way through #805. Please feel free to re-open this, or create a new issue if your problem persisted.

Felixoid commented 4 years ago

THank you. I'm not able to check it out yet but looks pretty promising. I'll come back in case of problems!