internetee-registry/test/test_helper.rb
Maciej Szlosarczyk 3acd605b90
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`.
2018-07-10 17:10:26 +03:00

43 lines
969 B
Ruby

if ENV['COVERAGE']
require 'simplecov'
SimpleCov.command_name 'test'
SimpleCov.start 'rails'
end
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/mock'
require 'capybara/rails'
require 'capybara/minitest'
require 'webmock/minitest'
require 'support/rails5_assetions' # Remove once upgraded to Rails 5
require 'application_system_test_case'
Setting.address_processing = false
Setting.registry_country_code = 'US'
class ActiveSupport::TestCase
include FactoryBot::Syntax::Methods
ActiveRecord::Migration.check_pending!
fixtures :all
teardown do
travel_back
end
end
class ActionDispatch::IntegrationTest
include Capybara::DSL
include Capybara::Minitest::Assertions
include AbstractController::Translation
include Devise::Test::IntegrationHelpers
teardown do
WebMock.reset!
Capybara.reset_sessions!
Capybara.use_default_driver
end
end