Revert that Rakefile!
To my slight embarrassment, I just noticed the following comments at the top of the Rails-generated So ignore my suggestion to edit your Combining the tips from the past couple of posts and tidying up a bit, mine looks like this:
Technorati tags: ruby rails coverage testing tdd rcoverage rcovRakefile
:
# Add your own tasks in files placed in lib/tasks ending in .rake
# for example lib/tasks/switchtower.rake, and they will automatically be available to Rake
Rakefile
, and create a lib/tasks/rcov.rake
instead.
require 'rake/clean'
# output goes to subdirectories of this one
RCOV_OUT = "coverage"
# "rake clobber" to remove output directory (along with other generated stuff)
CLOBBER.include(RCOV_OUT)
# don't report coverage on these files
RCOV_EXCLUDE = %w(boot.rb environment.rb).join(',')
# RCOV command, run as though from the commandline. Amend as required or perhaps move to config/environment.rb?
RCOV = "/ruby/bin/ruby /ruby/bin/rcov --no-color --exclude #{RCOV_EXCLUDE}"
desc "generate a unit test coverage report in coverage/unit; see coverage/unit/index.html afterwards"
task :coverage_units do
sh "#{RCOV} --output #{RCOV_OUT}/unit test/unit_tests.rb"
end
desc "generate a functional test coverage report in coverage/functional; see coverage/functional/index.html afterwards"
task :coverage_functional do
sh "#{RCOV} --output #{RCOV_OUT}/functional test/functional_tests.rb"
end
desc "generate a coverage report for unit and functional tests together in coverage/all; see coverage/all/index.html afterwards"
task :coverage_all do
sh "#{RCOV} --output #{RCOV_OUT}/all test/all_tests.rb"
end
desc "equivalent to coverage_all"
task :coverage => [:coverage_all]