rake coverage failing with rspec-puppet

130 views
Skip to first unread message

Rich Burroughs

unread,
Oct 12, 2015, 7:42:48 PM10/12/15
to puppet...@googlegroups.com
Hey folks,

I'm using a pretty recent version of Gareth's module skeleton and the included Rakefile. I can run "rake spec" fine but I don't seem to be able to get the "rake covereage" task to work.

--

$ bundle exec rake coverage
rake aborted!
NoMethodError: undefined method `rcov=' for #<RSpec::Core::RakeTask:0x007fb2c290d068>

Tasks: TOP => coverage
(See full trace by running task with --trace)

--
My first thought was to try "gem install rcov" but that blew up pretty badly. I did some googling and got the impress that rcov is no longer in use, and to use simplecov instead, but I installed that and I'm getting the same result.

I'm on OS X Mavericks/10.9.5.


Thanks,

Rich



Gareth Rushgrove

unread,
Oct 18, 2015, 1:32:37 PM10/18/15
to puppet...@googlegroups.com
On 12 October 2015 at 16:42, Rich Burroughs <ri...@richburroughs.com> wrote:
> Hey folks,
>
> I'm using a pretty recent version of Gareth's module skeleton and the
> included Rakefile. I can run "rake spec" fine but I don't seem to be able to
> get the "rake covereage" task to work.
>

What are you trying to get coverage for?

If Puppet code you just need to drop a file into your rspec-puppet
spec folder. See
https://github.com/rodjek/rspec-puppet#producing-coverage-reports or
for more details
http://www.morethanseven.net/2014/01/25/code-coverage-for-puppet-modules/

The latest version of the skeleton now includes proper coverage
support for ruby code as well using simplecov.

https://github.com/garethr/puppet-module-skeleton/blob/master/skeleton/spec/spec_helper.rb#L6-L16

Specifically this will generage ruby coverage reports in a .coverage
folder and a report to stdout just by running spec. Simplecov has
other formatters you can add too.

If memory serves the rake coverage task is from
puppetlabs-spec-helper. rcov only works on Ruby 1.8. It probably wants
removing.

Gareth

> --
>
> $ bundle exec rake coverage
> rake aborted!
> NoMethodError: undefined method `rcov=' for
> #<RSpec::Core::RakeTask:0x007fb2c290d068>
>
> Tasks: TOP => coverage
> (See full trace by running task with --trace)
>
> --
> My first thought was to try "gem install rcov" but that blew up pretty
> badly. I did some googling and got the impress that rcov is no longer in
> use, and to use simplecov instead, but I installed that and I'm getting the
> same result.
>
> I'm on OS X Mavericks/10.9.5.
>
>
> Thanks,
>
> Rich
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CAPGcbtBgKvsGcWNkKK1RLvvUAvoYpa4yV7KXybm1JRw7L8X1Nw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gareth Rushgrove
@garethr

devopsweekly.com
morethanseven.net
garethrushgrove.com

Rich Burroughs

unread,
Oct 18, 2015, 3:03:47 PM10/18/15
to puppet...@googlegroups.com
Hi Gareth,

Thank you. I wrote this right after PuppetConf and I was thinking, I should have asked him about this while we were talking :)

It's for rspec-puppet. I'll check out those links. I think I tried this with a new module that is using a very recent version of your skeleton.


Rich

Gareth Rushgrove

unread,
Oct 18, 2015, 4:23:00 PM10/18/15
to puppet...@googlegroups.com
On 18 October 2015 at 12:03, Rich Burroughs <ri...@richburroughs.com> wrote:
> Hi Gareth,
>
> Thank you. I wrote this right after PuppetConf and I was thinking, I should
> have asked him about this while we were talking :)
>
> It's for rspec-puppet. I'll check out those links. I think I tried this with
> a new module that is using a very recent version of your skeleton.
>

In which case you don't need a rake command, just to drop a file like
the following in the spec folder:

https://github.com/garethr/garethr-docker/blob/master/spec/classes/coverage_spec.rb

Will give you coverage results like this:

https://travis-ci.org/garethr/garethr-docker/jobs/84828196#L1075

Gareth
> https://groups.google.com/d/msgid/puppet-users/CAPGcbtAVQy3k1KumeB0RwHJRbAq6rhncrpMfs1Jfe6fMfHXikA%40mail.gmail.com.

Rich Burroughs

unread,
Oct 18, 2015, 4:28:13 PM10/18/15
to puppet...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages