[rspec-users] RCov results seem to include the spec files

Pat Maddox pergesu at gmail.com
Mon Apr 9 01:37:55 EDT 2007

I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and
decided to add it to my project.  My rakefile looks like this:

require "rake"
require "spec/rake/spectask"

desc "Run all specs with RCov"
Spec::Rake::SpecTask.new("spec:rcov") do |t|
  t.spec_files = FileList["spec/**/*_spec.rb"]
  t.rcov = true

When I run rake spec:rcov, it runs the specs using RCov and generates
the reports, but it's including all my spec files as well.

At the very bottom I'll see stuff like
spec/models/user_spec.rb   	 89   	 73   	100.0%

it even includes spec_helper.rb!

I don't really care to know that my specs are covered :)

Here's the command that's being run as a result of the rake task:
-I"/usr/local/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" -S rcov
--exclude lib\/spec,bin\/spec,config\/boot.rb -o "coverage"
"/usr/local/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" --
"spec/helpers/books_helper_spec.rb" "spec/models/book_spec.rb"

rspec 0.8.2, rcov

I noticed that the example output at
http://rspec.rubyforge.org/coverage/index.html doesn't seem to share
this.  So how can I make rcov ignore the spec files themselves?


More information about the rspec-users mailing list