mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 07:34:45 +02:00
Change inheritance structure to match the one from Rails 5 more
In the future, ApplicationSystemTestCase should inherit from ActionDispatch::SystemTestCase and JavaScriptApplicationSystemTestCase could possibly be removed if the `driven_by` method works as it is promised in Rails documentation: http://api.rubyonrails.org/v5.2/classes/ActionDispatch/SystemTestCase.html Consider introducing another class between ActionDispatch::IntegrationTest and other items inheriting from it, as the general Rails practice seems to have `ApplicationIntegrationTest`, as we do have `ApplicationRecord` and `ApplicationController`.
This commit is contained in:
parent
0fa30591a8
commit
3acd605b90
3 changed files with 45 additions and 39 deletions
42
test/application_system_test_case.rb
Normal file
42
test/application_system_test_case.rb
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
require 'database_cleaner'
|
||||||
|
require 'selenium/webdriver'
|
||||||
|
|
||||||
|
class ApplicationSystemTestCase < ActionDispatch::IntegrationTest; end
|
||||||
|
|
||||||
|
class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
|
||||||
|
self.use_transactional_fixtures = false
|
||||||
|
DatabaseCleaner.strategy = :truncation
|
||||||
|
|
||||||
|
Capybara.register_driver(:chrome) do |_app|
|
||||||
|
options = ::Selenium::WebDriver::Chrome::Options.new
|
||||||
|
|
||||||
|
options.add_argument('--headless')
|
||||||
|
options.add_argument('--no-sandbox')
|
||||||
|
options.add_argument('--disable-dev-shm-usage')
|
||||||
|
options.add_argument('--window-size=1400,1400')
|
||||||
|
|
||||||
|
Capybara::Selenium::Driver.new(Rails.application, browser: :chrome, options: options)
|
||||||
|
end
|
||||||
|
|
||||||
|
Capybara.register_server(:silent_puma) do |app, port, _host|
|
||||||
|
require 'rack/handler/puma'
|
||||||
|
Rack::Handler::Puma.run(app, Port: port, Threads: '0:2', Silent: true)
|
||||||
|
end
|
||||||
|
|
||||||
|
def setup
|
||||||
|
DatabaseCleaner.start
|
||||||
|
|
||||||
|
super
|
||||||
|
|
||||||
|
Capybara.current_driver = :chrome
|
||||||
|
Capybara.server = :silent_puma
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
super
|
||||||
|
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistrarSignInTest < JavascriptIntegrationTest
|
class RegistrarAreaSignInTest < JavaScriptApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
WebMock.allow_net_connect!
|
WebMock.allow_net_connect!
|
|
@ -11,9 +11,9 @@ require 'minitest/mock'
|
||||||
require 'capybara/rails'
|
require 'capybara/rails'
|
||||||
require 'capybara/minitest'
|
require 'capybara/minitest'
|
||||||
require 'webmock/minitest'
|
require 'webmock/minitest'
|
||||||
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'
|
|
||||||
|
require 'application_system_test_case'
|
||||||
|
|
||||||
Setting.address_processing = false
|
Setting.address_processing = false
|
||||||
Setting.registry_country_code = 'US'
|
Setting.registry_country_code = 'US'
|
||||||
|
@ -41,39 +41,3 @@ class ActionDispatch::IntegrationTest
|
||||||
Capybara.use_default_driver
|
Capybara.use_default_driver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class JavascriptIntegrationTest < ActionDispatch::IntegrationTest
|
|
||||||
self.use_transactional_fixtures = false
|
|
||||||
DatabaseCleaner.strategy = :truncation
|
|
||||||
|
|
||||||
Capybara.register_driver(:chrome) do |app|
|
|
||||||
options = ::Selenium::WebDriver::Chrome::Options.new
|
|
||||||
|
|
||||||
options.add_argument("--headless")
|
|
||||||
options.add_argument("--no-sandbox")
|
|
||||||
options.add_argument("--disable-dev-shm-usage")
|
|
||||||
options.add_argument("--window-size=1400,1400")
|
|
||||||
|
|
||||||
Capybara::Selenium::Driver.new(Rails.application, browser: :chrome, options: options)
|
|
||||||
end
|
|
||||||
|
|
||||||
Capybara.register_server(:silent_puma) do |app, port, _host|
|
|
||||||
require "rack/handler/puma"
|
|
||||||
Rack::Handler::Puma.run(app, Port: port, Threads: "0:2", Silent: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup
|
|
||||||
DatabaseCleaner.start
|
|
||||||
|
|
||||||
super
|
|
||||||
|
|
||||||
Capybara.current_driver = :chrome
|
|
||||||
Capybara.server = :silent_puma
|
|
||||||
end
|
|
||||||
|
|
||||||
def teardown
|
|
||||||
super
|
|
||||||
|
|
||||||
DatabaseCleaner.clean
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue