Forum: Ruby on Rails Transactions and fixtures

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
89441a6c74647d292f5cc951eae24cfa?d=identicon&s=25 Jack Christensen (Guest)
on 2005-12-12 20:13
(Received via mailing list)
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 Christensen
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2005-12-12 20:25
(Received via mailing list)
On 12/12/05, Jack Christensen <> 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.

This topic is locked and can not be replied to.