mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
Add database cleaner to tests that cannot run in a transaction
This commit is contained in:
parent
b164a58523
commit
e1f77c1d03
1 changed files with 11 additions and 0 deletions
|
@ -13,6 +13,7 @@ require 'capybara/minitest'
|
||||||
require 'webmock/minitest'
|
require 'webmock/minitest'
|
||||||
require 'selenium/webdriver'
|
require 'selenium/webdriver'
|
||||||
require 'support/rails5_assetions' # Remove once upgraded to Rails 5
|
require 'support/rails5_assetions' # Remove once upgraded to Rails 5
|
||||||
|
require 'database_cleaner'
|
||||||
|
|
||||||
Setting.address_processing = false
|
Setting.address_processing = false
|
||||||
Setting.registry_country_code = 'US'
|
Setting.registry_country_code = 'US'
|
||||||
|
@ -42,6 +43,8 @@ class ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
class JavascriptIntegrationTest < ActionDispatch::IntegrationTest
|
class JavascriptIntegrationTest < ActionDispatch::IntegrationTest
|
||||||
|
DatabaseCleaner.strategy = :truncation
|
||||||
|
|
||||||
Capybara.register_driver(:chrome) do |app|
|
Capybara.register_driver(:chrome) do |app|
|
||||||
options = ::Selenium::WebDriver::Chrome::Options.new
|
options = ::Selenium::WebDriver::Chrome::Options.new
|
||||||
|
|
||||||
|
@ -59,9 +62,17 @@ class JavascriptIntegrationTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
DatabaseCleaner.start
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
||||||
Capybara.current_driver = :chrome
|
Capybara.current_driver = :chrome
|
||||||
Capybara.server = :silent_puma
|
Capybara.server = :silent_puma
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
super
|
||||||
|
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue