Rake features:rcov question


#1

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,


#2

On 19 Jan 2009, at 15:49, James B. 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
removed_email_address@domain.invalid
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 W.
http://blog.mattwynne.net
http://www.songkick.com