When running rake spec:rcov
for a Rails 3 application, the files in the spec/
directory are getting included in the coverage statistics, but I don't want them to be. I want coverage statistics only for my actual application.
In older versions of RSpec, it was possible to customize this with a spec/rcov.opts
file with the line --exclude "spec/*"
but it seems that file is no longer read by Rspec 2. I tried creating a .rcov
file since spec/spec.opts
changed to .rspec
, but that didn't get read either.
I've found some documentation on how to do this when defining a rake task, but I'd rather not overwrite the provided rake task — it seems like this must be something other people have tried to do as well.
How can I customize the files that are excluded from coverage statistics?
For reference, the versions of all relevant gems I'm using are:
rails (3.0.5)
rake (0.8.7)
rcov (0.9.9)
rspec (2.5.0,)
rspec-core (2.5.1)
rspec-expectations (2.5.0,)
rspec-mocks (2.5.0)
rspec-rails (2.5.0)