remove transactions stuff from Test::Unit section

... as there is a specific section about it further down.
This commit is contained in:
Michael Kaiser-Nyman 2013-03-07 11:46:37 -08:00
parent d73c24d3e3
commit e5be289d1e
1 changed files with 2 additions and 24 deletions

View File

@ -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
```