diff --git a/README.md b/README.md index 8c822580..88db0c04 100644 --- a/README.md +++ b/README.md @@ -162,36 +162,14 @@ end ## Using Capybara with Test::Unit -* If you are using Rails, add `database_cleaner` to your Gemfile: - - ```ruby - group :test do - gem 'database_cleaner' - end - ``` - - Then add the following code in your `test_helper.rb` file to make - Capybara available in all test cases deriving from +* If you are using Rails, add the following code in your `test_helper.rb` + file to make Capybara available in all test cases deriving from `ActionDispatch::IntegrationTest`: ```ruby - # Transactional fixtures do not work with Selenium tests, because Capybara - # uses a separate server thread, which the transactions would be hidden - # from. We hence use DatabaseCleaner to truncate our test database. - DatabaseCleaner.strategy = :truncation - class ActionDispatch::IntegrationTest # Make the Capybara DSL available in all integration tests include Capybara::DSL - - # Stop ActiveRecord from wrapping tests in transactions - self.use_transactional_fixtures = false - - teardown do - DatabaseCleaner.clean # Truncate the database - Capybara.reset_sessions! # Forget the (simulated) browser state - Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver - end end ```