Forum: Ruby on Rails Transactions and fixtures

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jack C. (Guest)
on 2005-12-12 21: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 C.
removed_email_address@domain.invalid
Rick O. (Guest)
on 2005-12-12 21:25
(Received via mailing list)
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.

http://weblog.digett.com/articles/2005/07/06/trans...

-
rick
http://techno-weenie.net
This topic is locked and can not be replied to.