SimpleCov not covering inside def/methods

874 views Asked by At

Background: running Rails 3.2, Cucumber 1.1.4, and SimpleCov 0.5.4.

We have all of our Cucumber specs passing and the code should be covered. But the strange thing is that when we check the Cucumber coverage report generated by SimpleCov, the actual code inside methods/def are NOT covered at all. None of the method code is covered. The stranger thing is that class names, module names, accessor declarations are covered!

So, in this example, lines 01, 02, 03, 07 are shown as covered, but not 04, 05, 08, 09.

01 class Summary
02  attr_accessor :jobs
03  def initialize (events)
04    @events = events
05    createJobs
06  end
07  def createJobs
08   code here
09   code here
10  end
11 end

Any help would be so much appreciated!

Thanks.

1

There are 1 answers

0
SP. On

I think I know now what is going on. My cucumber features/steps are NOT testing the code directly, but testing through the browser (using capybara). So, coverage might not be running through the code (controller/models).

If that is true, is there a remedy? I do not want/need to have controller/model mentioned in my cucumber... rather it is testing from the user's point of view (the browser).