Skip to content

Commit

Permalink
Database cleaner driver_shares_db_connection_with_specs
Browse files Browse the repository at this point in the history
Introduce driver_shares_db_connection_with_specs to reveal intention
of database_cleaner.rb feature spec configuration.

https://forum.upcase.com/t/problem-with-js-true-and-rspec-capybara-phantomjs-poltergiest/2773/11?u=eliotsykes
  • Loading branch information
eliotsykes committed Apr 19, 2015
1 parent 6d32f11 commit 80cb5f7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/support/database_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@
end

config.before(:each, type: :feature) do
if Capybara.current_driver == :rack_test
# :rack_test driver's Rack app under test shares database connection
# with the specs, so we can use transaction strategy for speed.
# :rack_test driver's Rack app under test shares database connection
# with the specs, so we can use transaction strategy for speed.
driver_shares_db_connection_with_specs = Capybara.current_driver == :rack_test

if driver_shares_db_connection_with_specs
DatabaseCleaner.strategy = :transaction
else
# Non-:rack_test driver is probably a driver for a JavaScript browser
Expand Down

0 comments on commit 80cb5f7

Please sign in to comment.