tdd - How to Measure Code Coverage Rspec-Puppet -
i measure code coverage rspec-puppet implementing following example.
i have added at_exit { rspec::puppet::coverage.report! }
end of ./spec/classes/init_spec.rb
file.
init_spec.rb
require 'spec_helper' describe "vim" let(:facts) { { :operatingsystem => 'ubuntu' } } { should contain_class('vim::ubuntu')} end at_exit { rspec::puppet::coverage.report! }
running rspec
results in:
/etc/puppet/modules/vim/spec/classes/init_spec.rb:12: uninitialized constant rspec::puppet::coverage (nameerror)
rake spec
results in:
rake aborted! no such file load -- ace /usr/lib/ruby/vendor_ruby/rake/application.rb:357:in `require' /usr/lib/ruby/vendor_ruby/rake/application.rb:357:in `standard_rake_options' /usr/lib/ruby/1.8/optparse.rb:1298:in `call' /usr/lib/ruby/1.8/optparse.rb:1298:in `parse_in_order' /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' /usr/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order' /usr/lib/ruby/1.8/optparse.rb:1248:in `order!' /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!' /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!' /usr/lib/ruby/vendor_ruby/rake/application.rb:425:in `handle_options' /usr/lib/ruby/vendor_ruby/rake/application.rb:74:in `init' /usr/lib/ruby/vendor_ruby/rake/application.rb:133:in `standard_exception_handling' /usr/lib/ruby/vendor_ruby/rake/application.rb:72:in `init' /usr/lib/ruby/vendor_ruby/rake/application.rb:64:in `run' /usr/lib/ruby/vendor_ruby/rake/application.rb:133:in `standard_exception_handling' /usr/lib/ruby/vendor_ruby/rake/application.rb:63:in `run' /usr/bin/rake:27
note puppet labs' github fork of rspec-puppet
outdated more year. coverage code found in author's original repo.
just pulling master
repo might enough resolve issue.
Comments
Post a Comment