Search code examples
ruby-on-railsrspecdatabase-cleaner

Is the database trucation strategy will force every thread to use the same database?


In reference to this thread here, does this mean a truncation strategy will force every thread to use the same database, or does it mean Capybara + Rspec will run in the same thread?


Solution

  • There is only one database independent of what database cleaner strategy you are using and RSpec and Capybara always run in the same thread.

    The SO question you are referring to is discussing the fact that the Selenium server is run in a separate thread, which (normally) implies a separate database connection which implies a separate transaction from the transaction used by Capybara/RSpec.