Menu

Back Home

Remember Rcov?

Rcov helps to identify code that is not being being hit by your tests (or maybe some functions left behind after refactoring). It’s very easy to get it running as well:

[ccN]
$ sudo gem install rcov
[/ccN]

Plug this rake task into /lib/tasks/rcov.rake

[ccN_ruby]
require ‘rcov/rcovtask’

namespace :rcov do
desc ‘Measures test coverage using rcov’
Rcov::RcovTask.new(:test) do |rcov|
rcov.pattern = %w(test/unit/**/*_test.rb test/functional/**/*_test.rb test/integration/**/*_test.rb)
rcov.output_dir = ‘rcov’
rcov.verbose = true
rcov.rcov_opts << ‘–exclude “gems/*”‘ rcov.rcov_opts << ‘–rails’ end end [/ccN_ruby] And finally run it: [ccN] $ rake rcov:test [/ccN] It’s so easy you have no excuse not to have it.

2 Responses to Remember Rcov?

  1. rhianna says:

    Very good post, Thanks. Pls also visit my site for fun flash games here moofreegames.blogspot.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>