Skip to content
This repository was archived by the owner on Nov 16, 2018. It is now read-only.

Using RCov with Cucumber and Rails

mischa edited this page Aug 13, 2010 · 18 revisions

How to use RCov with Cucumber and Rails

This page serves as an easy way to learn how to use cucumber and RCov together.

Quick example

First, Aslak recommends that you use spicycode’s RCov instead of the ‘official’ one, as it currently segfaults too much for most people’s taste.

gem sources -a http://gems.github.com
gem uninstall rcov
gem install spicycode-rcov

Second, you’ll need to open up the cucumber generated task file and set the rcov config option.

#lib/tasks/cucumber.rake
$:.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
  t.cucumber_opts = "--format pretty"
  t.rcov = true
end
task :features => 'db:test:prepare'

Now when you run rake:features, coverage information will be in rails_root/coverage

Other ways to run features

See Running features

Options

TODO:

How to write a task to run features with.without rcov

How to pass rcov options

Clone this wiki locally