I just installed the SimpleCov gem to generate code coverage reports on my Rails 3.2.6 app, and it works great with RSpec, just not with Spork. I am able to get the desired correct report by running rspec --no-drb spec/, but I'd like to also get them with Spork running using just rspec spec/.
Given that there have been people who have had success with this, it seems likely I have errors in my setup. I have read through the setup instructions as well as the GitHub issue that purports to have a fix for Spork users, but still no luck. I'm wondering if there is anyone who can provide a full example of their working spec/spec_helper.rb file that I could use for reference, as extensive Googling has only turned up snippets. On the advice of other sites, I've tried changing the config.cache_classes in config/environments/test.rb from the default of true to false to !(ENV['DRB'] == 'true'), with no luck.
For reference, this is how I'm setup:
Gemfile
group :development, :test do
# ...
gem 'rspec-rails', '2.10.1'
end
group :test do
# ...
gem 'spork', '0.9.0'
gem 'simplecov', '0.6.4', require: false
end
.spec
--colour
--drb
spec/spec_helper.rb (changed as per the GitHub issue)
require 'simplecov'
SimpleCov.start 'rails'
require 'rubygems'
require 'spork'
Spork.prefork do
unless ENV['DRB']
require 'simplecov'
SimpleCov.start 'rails'
end
ENV["RAILS_ENV"] ||= 'test