[rspec-users] RSpec not testing ".sum"

David Chelimsky dchelimsky at gmail.com
Mon Nov 15 16:13:31 EST 2010


On Nov 15, 2010, at 2:13 PM, Andrew Davis wrote:

> Hello all,
> 
> I'm on the final stretch of testing my model, and I've realized that one
> simple line isn't being tested. I was hoping to get some insight on what
> I can do to accomplish this. The line that isn't being covered by Rcov
> is the ".sum". See code here:
> 
> Test:
> http://pastie.org/private/djdqtmatp58acas3ysszq
> 
> Model:
> http://pastie.org/private/kphng5jjnfn2imz52nceq
> 
> So each Task Order has some crazy associations, but in the end, it's
> summing the collection of criterion rollup scores. The test passes, but
> the ".sum" isn't being covered. Might I be missing something?
> 
> rcov (0.9.9)
> rspec (1.3.0)
> rspec-rails (1.3.2)
> rails (2.3.8)
> ruby (1.8.7)
> 
> Thanks in advance,

Rcov is not 100% reliable this way. If you were to remove the ".sum" from the line it is one, I'd bet you see failures. Turn that into a one liner and you should be fine.

Cheers,
David

> Andrew Davis



More information about the rspec-users mailing list