Rcov does not exclude gems when running rake spec:rcov

449 Views Asked by At

I use Rspec to develop and test custom extensions for Radiant. When running rake spec:rcov in the extension dir, it runs all tests from my spec folder but generates coverage files for all gems that I have included within my Gemfile. I tried putting the following rcov.opts file into the spec folder:

--exclude "gems/*" 
--rails

but it does not make any difference.

My Gems:

gem "rails", "2.3.11"
gem "radiant", "0.9.1"
...

group :test do
    gem 'cucumber-rails', '0.2.4'
    gem 'database_cleaner', '0.4.3'
    gem 'webrat', '0.6.0'
    gem 'rspec', '1.3.0'
    gem 'rspec-rails', '1.3.2'
    gem 'shoulda-matchers'
    gem 'factory_girl', '1.3.2'
    gem 'rcov', '~> 0.9.9'
end

How can I force rcov to exclude gems from coverage?

(I am on MacOSX, Bundler, RVM)

1

There are 1 best solutions below

0
On

Try using --exclude 'gems\/' instead of 'gems/*'.

The --exclude option takes a regular expression or a comma separated list of regular expressions, not a glob pattern as you have tried.