On Dec 20, 2:19 am, philly-mac <[email protected]> wrote:
> I currently have a problem with capybara when testing. When using the
> selenium or webkit driver, it spins a new thread in which it runs the
> process, separate from the main thread.
>
> What this means that any objects that are created in this time are
> left in the database when the test exits and I either have to manually
> clean them up, or use something like the database_cleaner gem. The
> problem with the database cleaner gem is that I get
>
> PGError: ERROR:  cannot truncate a table referenced in a foreign key
> constraint (Sequel::DatabaseError)
>
> error when I try to clean the database.
>
> So I guess the best solution is to make all threads use the same
> transaction when testing or have a way to disable referential
> integrity when the database is cleaned.

Well, you could just have database_cleaner do a delete instead of a
truncate.  It doesn't appear to support that for Sequel, which seems
very odd to me.  I'm sure a patch adding support for delete would be
fairly trivial.

Alternatively, you could try using the single threaded connection pool
(via the :single_threaded=>true Database option).  As long as there
isn't simultaneous database access by multiple threads, that may work.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to