public
Last active

  • Download Gist
rcov.rake
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
if defined?(RSpec)
namespace :rcov do
RSpec::Core::RakeTask.new(:rspec_aggregate) do |task|
task.pattern = 'spec/**/*_spec.rb'
task.rspec_opts = "--format progress"
task.rcov = true
task.rcov_opts = "--rails --exclude osx\/objc,spec,gems\/ " +
"--aggregate tmp/coverage.data"
end
 
Cucumber::Rake::Task.new(:cucumber_aggregate) do |task|
task.rcov = true
task.rcov_opts = "--rails --exclude osx\/objc,gems\/,spec\/,features\/ " +
"--aggregate tmp/coverage.data -o 'coverage'"
end
 
task :clean_aggregate do
rm "tmp/coverage.data" if File.exist?("tmp/coverage.data")
end
 
desc "Run aggregate coverage from rspec and cucumber"
task :rcov => ["rcov:clean_aggregate",
"rcov:rspec_aggregate",
"rcov:cucumber_aggregate"]
 
desc "Find potentially unused app code"
Cucumber::Rake::Task.new(:unused) do |task|
task.rcov = true
task.rcov_opts = "--rails --exclude osx\/objc,spec,gems\/,features\/ " +
"--only-uncovered"
end
 
desc "Find unused cucumber step definitions"
Cucumber::Rake::Task.new(:steps) do |task|
task.rcov = true
task.rcov_opts = "--rails --exclude osx\/objc,spec,gems\/,app\/,lib\/" +
"--only-uncovered"
end
end
 
desc "Run cumulative coverage from rspec and cucumber"
task :rcov => ["rcov:clean", "rcov:rspec_aggregate", "rcov:cucumber_aggregate"]
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.