Skip to content

Instantly share code, notes, and snippets.

@eteubert
Created April 18, 2011 12:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eteubert/925242 to your computer and use it in GitHub Desktop.
Save eteubert/925242 to your computer and use it in GitHub Desktop.
A rake task to combine the rcov coverage reports of RSpec and Cucumber
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
namespace :rcov do
rcov_options = %w{
--rails
--exclude osx\/objc,gems\/,spec\/,features\/,seeds\/
--aggregate coverage/coverage.data
}
Cucumber::Rake::Task.new(:cucumber) do |t|
t.cucumber_opts = "--format pretty"
t.rcov = true
t.rcov_opts = rcov_options
end
RSpec::Core::RakeTask.new(:rspec) do |t|
t.spec_opts = ["--color"]
t.rcov = true
t.rcov_opts = rcov_options
t.rcov_opts += %w{--include views -Ispec}
end
desc "Run cucumber & rspec to generate aggregated coverage"
task :all do |t|
rm "coverage/coverage.data" if File.exist?("coverage/coverage.data")
Rake::Task['rcov:rspec'].invoke
Rake::Task["rcov:cucumber"].invoke
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment