Transactions and fixtures


Is there some problem with using transactional fixtures if your code
uses transactions?

I have problems with records disappearing when run in rake (but not one
file at a time). I looked at the test log and noticed some commit
statements. It would seem this is causing the problem. However, my code
is not explicitly calling commit. It appears the normal transaction
blocks may be calling commit.

For now I can just disable transactional fixtures, but the slow down is
pretty bad. Any ideas?

Thanks for your help.

Jack C.


On 12/12/05, Jack C. removed_email_address@domain.invalid wrote:

pretty bad. Any ideas?
There are two solutions:

uses_transactions specifies individual methods of a test suite that
use transactions, and therefore should not use transactional fixtures.

uses_transactions :test_this_uses_transactions

Or, put all your transactional tests in a single suite and turn off
transactional fixtures for the whole thing.

Here’s a blog post I made awhile back on it.