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.
This commit is contained in:
Maciej Szlosarczyk 2018-07-27 09:36:27 +03:00
parent 311aa503b3
commit 526a9ccd58
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
41 changed files with 42 additions and 42 deletions

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainCreateNameserversTest < ActionDispatch::IntegrationTest
class EppDomainCreateNameserversTest < ApplicationIntegrationTest
# Glue record requirement
def test_nameserver_ip_address_is_required_if_hostname_is_under_the_same_domain
request_xml = <<-XML

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainCreateTransferCodeTest < ActionDispatch::IntegrationTest
class EppDomainCreateTransferCodeTest < ApplicationIntegrationTest
setup do
travel_to Time.zone.parse('2010-07-05')
end

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainDeleteTest < ActionDispatch::IntegrationTest
class EppDomainDeleteTest < ApplicationIntegrationTest
def test_bypasses_domain_and_registrant_and_contacts_validation
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainRenewTest < ActionDispatch::IntegrationTest
class EppDomainRenewTest < ApplicationIntegrationTest
self.use_transactional_fixtures = false
setup do

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainUpdateTest < ActionDispatch::IntegrationTest
class EppDomainUpdateTest < ApplicationIntegrationTest
def test_update_domain
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainTransferBaseTest < ActionDispatch::IntegrationTest
class EppDomainTransferBaseTest < ApplicationIntegrationTest
def test_non_existent_domain
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainTransferQueryTest < ActionDispatch::IntegrationTest
class EppDomainTransferQueryTest < ApplicationIntegrationTest
def test_returns_domain_transfer_details
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
xml_doc = Nokogiri::XML(response.body)

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppDomainTransferRequestTest < ActionDispatch::IntegrationTest
class EppDomainTransferRequestTest < ApplicationIntegrationTest
setup do
@domain = domains(:shop)
@new_registrar = registrars(:goodnames)

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppLoginCredentialsTest < ActionDispatch::IntegrationTest
class EppLoginCredentialsTest < ApplicationIntegrationTest
def test_correct_credentials
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppLoginSessionLimitTest < ActionDispatch::IntegrationTest
class EppLoginSessionLimitTest < ApplicationIntegrationTest
setup do
travel_to Time.zone.parse('2010-07-05')
EppSession.delete_all

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppLogoutTest < ActionDispatch::IntegrationTest
class EppLogoutTest < ApplicationIntegrationTest
def test_success_response
post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert Nokogiri::XML(response.body).at_css('result[code="1500"]')

View file

@ -1,6 +1,6 @@
require 'test_helper'
class EppPollTest < ActionDispatch::IntegrationTest
class EppPollTest < ApplicationIntegrationTest
def test_messages
post '/epp/command/poll', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_equal '1301', Nokogiri::XML(response.body).at_css('result')[:code]