internetee-registry/test/test_helper.rb
Maciej Szlosarczyk 526a9ccd58
Change test structure to follow closer newer Rails 5 rules
* Create new class called ApplicationIntegrationTest, so we don't have
  to override ActionDispatch::IntegrationTest
* Move UI tests to inherit from ApplicationSystemTestCase
* Existing REST API or EPP tests inherit from
  ApplicationIntegrationTest.
* Move `require 'application_system_test_case'` at the end of
  `test_helper`

I don't particularly agree with the Rails' convention of treating UI
tests as system tests and API tests as integration tests, but I see no
benefit in actively fighting against it.
2018-07-27 09:36:27 +03:00

43 lines
999 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_assertions' # Remove once upgraded to Rails 5
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 ApplicationIntegrationTest < 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
require 'application_system_test_case'