Skip to content

Instantly share code, notes, and snippets.

@rmehner
Forked from jferris/rcov.rake
Created January 31, 2011 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmehner/804327 to your computer and use it in GitHub Desktop.
Save rmehner/804327 to your computer and use it in GitHub Desktop.
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 do
rm "tmp/coverage.data" if File.exist?("tmp/coverage.data")
end
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment