Skip to content

Instantly share code, notes, and snippets.

@mikhailov
Created February 12, 2010 06:56
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 mikhailov/302385 to your computer and use it in GitHub Desktop.
Save mikhailov/302385 to your computer and use it in GitHub Desktop.
require 'cucumber/rake/task'
require 'spec/rake/spectask'
require 'database_cleaner'
namespace :rcov do
Cucumber::Rake::Task.new(:cucumber) do |t|
t.rcov = true
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
t.rcov_opts << %[-o "coverage"]
end
Spec::Rake::SpecTask.new(:rspec) do |t|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = lambda do
IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
end
end
desc "Run both specs and features to generate aggregated coverage"
task :all do |t|
rm "coverage.data" if File.exist?("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