How to reload fixture instance?

In my test case, I have lines that reads something like this:

fixtures :orders
assert_equal 0, orders(:eric).amount
Order.update_all_amounts
assert_equal 30, orders(:eric).amount

This wouldn’t work because, apparently, the orders method doesn’t
reload the :eric instance on the second invocation, so it would still
have the amount zero, even though update_all_amounts has already
changed it to thirty in the database.

My question is, how do I force orders(:eric) to re-fetch the data from
the db, without using the find() method directly?

Thanks,
Eric

On 9/28/07, Eric [email protected] wrote:

have the amount zero, even though update_all_amounts has already
changed it to thirty in the database.

My question is, how do I force orders(:eric) to re-fetch the data from
the db, without using the find() method directly?

You can just reload the model:

assert_equal 30, orders(:eric).reload.amount