mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
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:
parent
311aa503b3
commit
526a9ccd58
41 changed files with 42 additions and 42 deletions
|
@ -3,7 +3,7 @@ require 'test_helper'
|
||||||
require 'database_cleaner'
|
require 'database_cleaner'
|
||||||
require 'selenium/webdriver'
|
require 'selenium/webdriver'
|
||||||
|
|
||||||
class ApplicationSystemTestCase < ActionDispatch::IntegrationTest; end
|
ApplicationSystemTestCase = Class.new(ApplicationIntegrationTest)
|
||||||
|
|
||||||
class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
|
class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
|
||||||
self.use_transactional_fixtures = false
|
self.use_transactional_fixtures = false
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class APIDomainContactsTest < ActionDispatch::IntegrationTest
|
class APIDomainContactsTest < ApplicationIntegrationTest
|
||||||
def test_replace_all_tech_contacts_of_the_current_registrar
|
def test_replace_all_tech_contacts_of_the_current_registrar
|
||||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||||
new_contact_id: 'john-001' },
|
new_contact_id: 'john-001' },
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class APIDomainTransfersTest < ActionDispatch::IntegrationTest
|
class APIDomainTransfersTest < ApplicationIntegrationTest
|
||||||
setup do
|
setup do
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
@new_registrar = registrars(:goodnames)
|
@new_registrar = registrars(:goodnames)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class APINameserversPutTest < ActionDispatch::IntegrationTest
|
class APINameserversPutTest < ApplicationIntegrationTest
|
||||||
def test_replaces_registrar_nameservers
|
def test_replaces_registrar_nameservers
|
||||||
old_nameserver_ids = [nameservers(:shop_ns1).id,
|
old_nameserver_ids = [nameservers(:shop_ns1).id,
|
||||||
nameservers(:airport_ns1).id,
|
nameservers(:airport_ns1).id,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainCreateNameserversTest < ActionDispatch::IntegrationTest
|
class EppDomainCreateNameserversTest < ApplicationIntegrationTest
|
||||||
# Glue record requirement
|
# Glue record requirement
|
||||||
def test_nameserver_ip_address_is_required_if_hostname_is_under_the_same_domain
|
def test_nameserver_ip_address_is_required_if_hostname_is_under_the_same_domain
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainCreateTransferCodeTest < ActionDispatch::IntegrationTest
|
class EppDomainCreateTransferCodeTest < ApplicationIntegrationTest
|
||||||
setup do
|
setup do
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainDeleteTest < ActionDispatch::IntegrationTest
|
class EppDomainDeleteTest < ApplicationIntegrationTest
|
||||||
def test_bypasses_domain_and_registrant_and_contacts_validation
|
def test_bypasses_domain_and_registrant_and_contacts_validation
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainRenewTest < ActionDispatch::IntegrationTest
|
class EppDomainRenewTest < ApplicationIntegrationTest
|
||||||
self.use_transactional_fixtures = false
|
self.use_transactional_fixtures = false
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainUpdateTest < ActionDispatch::IntegrationTest
|
class EppDomainUpdateTest < ApplicationIntegrationTest
|
||||||
def test_update_domain
|
def test_update_domain
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainTransferBaseTest < ActionDispatch::IntegrationTest
|
class EppDomainTransferBaseTest < ApplicationIntegrationTest
|
||||||
def test_non_existent_domain
|
def test_non_existent_domain
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainTransferQueryTest < ActionDispatch::IntegrationTest
|
class EppDomainTransferQueryTest < ApplicationIntegrationTest
|
||||||
def test_returns_domain_transfer_details
|
def test_returns_domain_transfer_details
|
||||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
xml_doc = Nokogiri::XML(response.body)
|
xml_doc = Nokogiri::XML(response.body)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainTransferRequestTest < ActionDispatch::IntegrationTest
|
class EppDomainTransferRequestTest < ApplicationIntegrationTest
|
||||||
setup do
|
setup do
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
@new_registrar = registrars(:goodnames)
|
@new_registrar = registrars(:goodnames)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppLoginCredentialsTest < ActionDispatch::IntegrationTest
|
class EppLoginCredentialsTest < ApplicationIntegrationTest
|
||||||
def test_correct_credentials
|
def test_correct_credentials
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppLoginSessionLimitTest < ActionDispatch::IntegrationTest
|
class EppLoginSessionLimitTest < ApplicationIntegrationTest
|
||||||
setup do
|
setup do
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
EppSession.delete_all
|
EppSession.delete_all
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppLogoutTest < ActionDispatch::IntegrationTest
|
class EppLogoutTest < ApplicationIntegrationTest
|
||||||
def test_success_response
|
def test_success_response
|
||||||
post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
assert Nokogiri::XML(response.body).at_css('result[code="1500"]')
|
assert Nokogiri::XML(response.body).at_css('result[code="1500"]')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppPollTest < ActionDispatch::IntegrationTest
|
class EppPollTest < ApplicationIntegrationTest
|
||||||
def test_messages
|
def test_messages
|
||||||
post '/epp/command/poll', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
post '/epp/command/poll', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
assert_equal '1301', Nokogiri::XML(response.body).at_css('result')[:code]
|
assert_equal '1301', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ContactVersionsTest < ActionDispatch::IntegrationTest
|
class ContactVersionsTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminContactsTest < ActionDispatch::IntegrationTest
|
class AdminContactsTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class DomainVersionsTest < ActionDispatch::IntegrationTest
|
class DomainVersionsTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminAreaDomainDetailsTest < ActionDispatch::IntegrationTest
|
class AdminAreaDomainDetailsTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminAreaDomainForceDeleteTest < ActionDispatch::IntegrationTest
|
class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
||||||
include ActionMailer::TestHelper
|
include ActionMailer::TestHelper
|
||||||
|
|
||||||
setup do
|
setup do
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminDomainsTestTest < ActionDispatch::IntegrationTest
|
class AdminDomainsTestTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminAreaNewMailTemplateTest < ActionDispatch::IntegrationTest
|
class AdminAreaNewMailTemplateTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminAreaDeleteRegistrarTest < ActionDispatch::IntegrationTest
|
class AdminAreaDeleteRegistrarTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminAreaRegistrarDetailsTest < ActionDispatch::IntegrationTest
|
class AdminAreaRegistrarDetailsTest < ApplicationSystemTestCase
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
setup do
|
setup do
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminAreaEditRegistrarTest < ActionDispatch::IntegrationTest
|
class AdminAreaEditRegistrarTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
@registrar = registrars(:bestnames)
|
@registrar = registrars(:bestnames)
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class AdminAreaNewRegistrarTest < ActionDispatch::IntegrationTest
|
class AdminAreaNewRegistrarTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistrantDomainsTest < ActionDispatch::IntegrationTest
|
class RegistrantDomainsTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:registrant)
|
sign_in users(:registrant)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistrantLayoutTest < ActionDispatch::IntegrationTest
|
class RegistrantLayoutTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
sign_in(users(:registrant))
|
sign_in(users(:registrant))
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class BalanceTopUpTest < ActionDispatch::IntegrationTest
|
class BalanceTopUpTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:api_bestnames)
|
sign_in users(:api_bestnames)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistrarAreaBulkTransferTest < ActionDispatch::IntegrationTest
|
class RegistrarAreaBulkTransferTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:api_goodnames)
|
sign_in users(:api_goodnames)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistrarAreaNameserverBulkChangeTest < ActionDispatch::IntegrationTest
|
class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:api_goodnames)
|
sign_in users(:api_goodnames)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistrarAreaTechContactBulkChangeTest < ActionDispatch::IntegrationTest
|
class RegistrarAreaTechContactBulkChangeTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:api_bestnames)
|
sign_in users(:api_bestnames)
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistrarDomainsTest < ActionDispatch::IntegrationTest
|
class RegistrarDomainsTest < ApplicationSystemTestCase
|
||||||
def test_downloads_domain_list_as_csv
|
def test_downloads_domain_list_as_csv
|
||||||
sign_in users(:api_bestnames)
|
sign_in users(:api_bestnames)
|
||||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
travel_to Time.zone.parse('2010-07-05 10:30')
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ListInvoicesTest < ActionDispatch::IntegrationTest
|
class ListInvoicesTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
|
class NewInvoicePaymentTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class NewInvoiceTest < ActionDispatch::IntegrationTest
|
class NewInvoiceTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class PaymentCallbackTest < ActionDispatch::IntegrationTest
|
class PaymentCallbackTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class PaymentReturnTest < ActionDispatch::IntegrationTest
|
class PaymentReturnTest < ApplicationSystemTestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -13,8 +13,6 @@ require 'capybara/minitest'
|
||||||
require 'webmock/minitest'
|
require 'webmock/minitest'
|
||||||
require 'support/rails5_assertions' # Remove once upgraded to Rails 5
|
require 'support/rails5_assertions' # Remove once upgraded to Rails 5
|
||||||
|
|
||||||
require 'application_system_test_case'
|
|
||||||
|
|
||||||
Setting.address_processing = false
|
Setting.address_processing = false
|
||||||
Setting.registry_country_code = 'US'
|
Setting.registry_country_code = 'US'
|
||||||
|
|
||||||
|
@ -29,7 +27,7 @@ class ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ActionDispatch::IntegrationTest
|
class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
|
||||||
include Capybara::DSL
|
include Capybara::DSL
|
||||||
include Capybara::Minitest::Assertions
|
include Capybara::Minitest::Assertions
|
||||||
include AbstractController::Translation
|
include AbstractController::Translation
|
||||||
|
@ -41,3 +39,5 @@ class ActionDispatch::IntegrationTest
|
||||||
Capybara.use_default_driver
|
Capybara.use_default_driver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require 'application_system_test_case'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue