RSpec not testing ".sum"

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,

Andrew D.

Scratch this.

It has been noted that rcov has a hard time distinguishing what the last
line is.

If I put all of the code in that model on one line, it works great.

Thanks!

Andrew D.

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

Model:
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