small medium large xlarge

Generic-user-small
08 Dec 2010, 14:25
Graham Roy (1 post)

Hello.

For a while I was running this test and it always failed because it couldn’t find the book title in the order content. After looking at the output from the console window (by including a ‘puts mail’ in the test) it became clear that the order had no line items.

I managed to solve the problem by adding the lines:

cart = Cart.create LineItem.create(:cart => cart, :product => products(:ruby)) orders(:one).add_line_items_from_cart(cart)

before the mail was created:

mail = Notifier.order_shipped(orders(:one))

DId anyone else have this problem?

Also, is this the right way to do it or do you think it should be solved using just the fixture data so that it remains consistent for each of the tests?

Graham

You must be logged in to comment