Read more

Aggregated RSpec/Cucumber test coverage with RCov

Martin Straub
August 25, 2010Software engineer at makandra GmbH

With defaults, RCov doesn't work the way you how you would like it to. To create a nice test coverage report, copy the attached file to lib/tasks/rcov.rake. After that rake rcov:all will run all RSpec examples and Cucumber features. The report will be written RAILS_ROOT/coverage/index.html.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Here is what the task does in detail:

  • Generates aggregated coverage of both RSpec and Cucumber
  • Works with Rails 2 and Rails 3
  • Reports for app/**/*.rb and nothing else
  • If called with an environment variable IGNORE_SHARED_TRAITS=true it ignores Modularity Show archive.org snapshot traits in app/controllers/shared and app/models/shared (which may or may not be entirely correct for your case).
  • Tested that it works with Selenium features
  • Doesn't add rake tasks outside development environment
Posted by Martin Straub to makandra dev (2010-08-25 15:56)