Archive for July, 2012

RCov with RSpec > 2.6.0 not running tests

by Oliver on Friday, July 6th, 2012.

Just a quick note since this tripped me up yesterday. If you take a look at the changelog of RSpec between 2.6.0 and 2.6.1 you’ll see that it now “intelligently” senses when being used with RCov and requires the autorun file (which basically just sets the tests to start automatically after they have been set up).

At some point for one of our simple apps I upgraded all of the Gems in use to the latest version, which resulted in RSpec and its components moving to 2.10.x versions. The tests still ran as expected, but what I didn’t notice was the code coverage dropping significantly. I partially blame this on not checking the output of Jenkins frequently enough or making a dashboard of it on our central display, and partially on increasing code coverage. We had pretty poor coverage before, and after the refactor that led to the upgrade of various Gems we actually had a lot more coverage. The net result of added tests but RCov not running properly was that the coverage metrics didn’t change very much in the summary view.

Regardless, without require 'rspec/autorun' present in our Rakefile or spec_helper.rb I’m not entirely sure at first glance why the tests were running successfully before through RCov. As with a lot of issues, there’s just not enough time to debug a working system 🙂 For now, adding require 'rspec/autorun' to our spec_helper.rb, which is required by all spec files, has resolved the problem and our code coverage is back up to reasonable levels!

Tags: , , ,

Friday, July 6th, 2012 Tech 1 Comment