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
I have this working in a Rails app with these specific versions:
rails
(3.2.8)guard
(1.3.2)guard-spork
(1.1.0)spork
(0.9.2)simplecov
(0.6.4)rspec-rails
(2.11.0)The spec/spec_helper.rb
looks like this:
require "spork"
Spork.prefork do
end
Spork.each_run do
require "simplecov"
SimpleCov.start "rails"
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../../config/environment", __FILE__)
require "rspec/rails"
require "capybara/rspec"
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
FactoryGirl.reload
end
While it is probably less-than-ideal to require everything in the Spork.each_run
block from a performance standpoint, this correctly runs SimpleCov on every test invocation and appears to have relatively low overhead.
I hope that helps. Good luck!