Forum: RSpec Rake features:rcov question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-01-19 16:49
I have reached a point where I thought that it might be useful to see
how must test coverage I have for the code I have written.  However,
running rake features:rcov produces some unexpected output.  I see this
in the index file:


/usr/lib/ruby/1.8/base64.rb ...
/usr/lib/ruby/1.8/benchmark.rb ...
...
/usr/lib/ruby/1.8/uri/mailto.rb

Then my files are reported

app/controllers/application_controller.rb
app/controllers/clients_controller.rb
...
 and so forth.  Now, I have checked the spec and test directory trees
and there does not seem to be anything in there that I recognize as
having anything to do with the ruby libraries.  My questions are: 1. Is
this normal behaviour for rcov? 2. If not, then what might I have done
to cause this?

Regards,
Cdf378de2284d8acf137122e541caa28?d=identicon&s=25 Matt Wynne (mattwynne)
on 2009-01-19 21:48
(Received via mailing list)
On 19 Jan 2009, at 15:49, James Byrne wrote:

> /usr/lib/ruby/1.8/uri/mailto.rb
> this normal behaviour for rcov? 2. If not, then what might I have done
> to cause this?
>
> Regards,
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Take a look at the --exclude option for rcov - that's what you need to
do. Otherwise by default it will tell you about coverage for every
ruby file that was touched during the test run, including things that
the testing framework called, and the things they called, etc.

I would have assumed this was in the default rake task that was
generated, but anyway you should be able to figure it out if you look
at rcov's options.

Running rcov yourself really isn't such a black art - from the command
line you can get coverage from a single feature using this:

     rcov --exclude 'gems/*.rb' /usr/local/bin/cucumber -- path/to/
the.feature


Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com
This topic is locked and can not be replied to.