Skip to content

Instantly share code, notes, and snippets.

@rurounijones
Created March 2, 2011 02:29
Show Gist options
  • Save rurounijones/850355 to your computer and use it in GitHub Desktop.
Save rurounijones/850355 to your computer and use it in GitHub Desktop.
Rcov rake files
begin
require 'cucumber/rake/task'
require 'rspec/rails'
require 'rspec/core/rake_task'
desc 'Run both specs and features to generate aggregated coverage'
task :rcov => 'rcov:all'
namespace :rcov do
def rcov_opts
['--exclude ".rvm/*,osx/objc,gems/*,spec/*,features/*,.bundle/*"',
'--rails',
'--aggregate "tmp/rcov.txt"'
]
end
Cucumber::Rake::Task.new(:cucumber, 'Run cucumber to generate coverage') do |t|
t.rcov = true
t.rcov_opts = rcov_opts
end
desc 'Run specs to generate coverage'
RSpec::Core::RakeTask.new(:rspec) do |t|
t.rcov = true
t.rcov_opts = rcov_opts
end
task :all do |t|
Rake::Task['rcov:cucumber'].invoke
Rake::Task['rcov:rspec'].invoke
end
end
rescue LoadError
desc 'cucumber rake task not available (cucumber not installed)'
task :cucumber do
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment