ruby-on-railsrspeccucumbersimplecov

Using SimpleCov to display Cucumber code coverage


Does anyone have any experience using Cucumber and the code coverage tool SimpleCov? I'd added the following lines env.rb file so Cucumber will fire off SimpleCov-

require 'simplecov'
SimpleCov.start 'rails'
SimpleCov.coverage_dir 'coverage/cucumber'

It does what it is supposed EXCEPT that the output file lists 0 files test, 0 relevent lines, 0 lines covered, etc. Any idea how I can make the code coverage come out right?


Solution

  • The SimpleCov statement has to be the very first thing in the env.rb file, before the other requires. Then it appears to work fine!