class GemHadar
def rcov_task
task if project extensions are present. If RCov is not available, it
enables verbose output. The task also conditionally depends on the :compile
required paths in the load path, specifies the test files to run, and
RCov to generate code coverage reports. It includes the test directory and
This method configures a :rcov task that runs the project's test suite with
using RCov.
The rcov_task method sets up a Rake task for executing code coverage tests
def rcov_task if defined?(::Rcov) rt = ::Rcov::RcovTask.new(:run_rcov) do |t| t.libs << test_dir t.libs.concat require_paths.to_a t.libs.uniq! t.test_files = test_files t.verbose = true t.rcov_opts = %W[-x '\\b#{test_dir}\/' -x '\\bgems\/'] end desc 'Run the rcov code coverage tests' task :rcov => [ (:compile if extensions.full?), rt.name ].compact clobber 'coverage' else desc 'Run the rcov code coverage tests' task :rcov do warn "rcov doesn't work for some reason, have you tried 'gem install rcov'?" end end end