Yeah, I know that usually don't make any sense, but here is why I'd like to 
try it.

I've been using those tricks we've discussed in another thread for being 
able to both implement a sandbox-mode for my Rails application as well as 
being able to run code inside before(:all) inside transactions under RSpec.

Great so far! But yesterday I started writing some tests with 
Capybara/Webkit for testing some JavaScript as well in the requests specs. 

That works by spawning a new thread for running the Rails/Rack application.

Then I first tried to run DatabaseCleaner.clean with the truncation 
strategy.

I noticed two problems: first, it seems to be incompatible with current 
Sequel versions:

https://github.com/bmabey/database_cleaner/pull/120

But this is not the real problem as it is pretty trivial do truncate the 
tables by myself.

The problem is that table truncation seems to be too slow for PostgreSQL 
for testing purposes (about 3s here).

So I moved to using DELETE statements which was way faster than truncate. 
Still not as fast as transactions, and I also have to deal with some more 
manual management due to foreign constraints in the order of table deletion 
and having to specify the tables manually.

But then I would like to make some experiments in supporting transactions 
on this kind of specs as well.

Basically for that to work, I'd need to be able to share the same 
connection between both threads (Rails/Rack application and the RSpec one).

Could you please advise me on any other trick for forcing Sequel to share 
the same connection everytime it needs one?

Thanks in advance,
Rodrigo.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/8jg8DijNVSMJ.
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