Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is some information missing regarding your rspec configuration and library usage that would probably you get an answer to this. That said, I've seen similar behavior in a multi-threaded environment when running rspec for integration specs.</p> <p>The advice found on <a href="https://github.com/grosser/parallel_tests/wiki" rel="nofollow">https://github.com/grosser/parallel_tests/wiki</a> looks to be misleading in regard to integration specs. Trying to rely on the <code>transaction</code> strategy of <code>DatabaseCleaner</code> or <code>use_transactional_fixtures</code> is guaranteed to result in deadlocks for any non-blocking database adapter.</p> <p>Capybara spins up multiple threads for integration specs. When the client and server threads attempt to interact with the same records at the same time you'll often end up with timeouts or deadlocks. Occasionally the deadlock can cause your suite run to hang permanently until it is killed manually.</p> <p>The most solid configuration I've found to prevent this is a combination of sharing the connection between <code>ActiveRecord</code> instances and judicious use of <code>DatabaseCleaner</code>.</p> <pre><code># integration_spec_helper.rb RSpec.configure do |config| config.use_transactional_fixtures = false class ActiveRecord::Base class_attribute :shared_connection def self.connection self.shared_connection || retrieve_connection end end config.before do |example| ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection if Capybara.current_driver == :webkit DatabaseCleaner.strategy = :deletion else DatabaseCleaner.strategy = :transaction end DatabaseCleaner.start end config.after do DatabaseCleaner.clean end end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload