mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-18 14:11:10 +00:00
Use Rails transactional tests
As of Rails 5.1:
- Rails has built-in support for running tests within database
transactions, so Database Cleaner is no longer needed for this.
- Rails automatically shares the database connection across threads,
so transactional_capybara is no longer needed.
Changes:
- Enable `use_transactional_tests`.
- Remove transactional_capybara.
- Remove the Database Cleaner test wrapper.
This resolves:
- transactional_capybara mismanages the shared database connection,
causing the connection to falsely report as idle after the first
test. At 6 minutes (idle_timeout + reaping_frequency) into testing,
the connection is closed, causing e.g. `PG::ConnectionBad` errors.
This commit is contained in:
parent
310fc8dc68
commit
c3e02c20b9
7 changed files with 3 additions and 24 deletions
|
|
@ -5,13 +5,4 @@ RSpec.configure do |config|
|
|||
DatabaseCleaner.clean_with(:truncation)
|
||||
Rails.application.load_seed
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do |example|
|
||||
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) if example.metadata[:js]
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue