Skip to content

Instantly share code, notes, and snippets.

@dejan
Created April 11, 2009 18:31
Show Gist options
  • Save dejan/93667 to your computer and use it in GitHub Desktop.
Save dejan/93667 to your computer and use it in GitHub Desktop.
rake test:coverage
namespace :test do
RCOV = "rcov --rails --aggregate coverage.data --text-summary -Ilib"
def rcov_on(files_selector)
unless Dir[files_selector].size == 0
system("#{RCOV} --html #{files_selector}")
end
end
desc 'Measures test coverage'
task :coverage do
rm_f "coverage"
rm_f "coverage.data"
rcov_on('test/unit/*_test.rb')
rcov_on('test/functional/*_test.rb')
rcov_on('test/integration/*_test.rb')
system("open coverage/index.html") if PLATFORM['darwin']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment