[rspec-users] Testing with has_many associations

Andy Croll lists at ruby-forum.com
Wed Apr 9 05:57:22 EDT 2008


Chris Parsons wrote:
> I'm guessing this spec will fail with your current code as I don't
> think CartItem::new_from_product is working.

Wow. I've never had code I hadn't posted correctly debugged before. You 
were absolutely right, thanks! Seems my testing approach in that spec 
was somehow faking out the all the tests I made.

> I'd also probably break down the specs differently and wrap the call
> to items and make the specs more contained:

I think this is where I'm going wrong, I keep letting my tests get too 
big. Even when I think they are small. Another good rule I've picked up 
from this is to always try and use less than two dots to abstract the 
models...

Big help thanks Chris.
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list