Issues with database/object caching and testing

Hi all,

I just burned two hours of development time trying to debug this issue. Can someone please tell me if there is a way to disable database caching when running unit tests or another way to avoid running into this type of problem??

This does not work: assert periods(:period1).ongoing? # Asserts true plays(:end_of_first_half).process # Ends the period assert !periods(:period1).ongoing? # Asserts false

This DOES work: assert periods(:period1).ongoing? # Asserts true plays(:end_of_first_half).process # Ends the period assert !Period.find(periods(:period1).id).ongoing? # Asserts true

I don't know exactly what this code is doing, but activerecord does cache associations and so on (and fixtures are only loaded once per test when you do periods(:period1). There's no easy way to disable this, periods(:period1).reload.ongoing? is a little less ugly than other alternatives.

Fred