mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
commit
df741f133f
30 changed files with 51 additions and 41 deletions
|
@ -43,6 +43,7 @@ Rails.application.configure do
|
|||
config.log_level = :debug
|
||||
config.active_job.queue_adapter = :test
|
||||
config.logger = ActiveSupport::Logger.new(nil)
|
||||
config.active_support.test_order = :random # :random is the default in Rails 5
|
||||
end
|
||||
|
||||
# In this mode, any jobs you queue will be run in the same thread, synchronously
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'test_helper'
|
|||
class AdminAreaDomainForceDeleteTest < ActionDispatch::IntegrationTest
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
def setup
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
@domain = domains(:shop)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AdminDomainsTestTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AdminAreaDeleteRegistrarTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AdminAreaEditRegistrarTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
@registrar = registrars(:bestnames)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AdminAreaNewRegistrarTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'test_helper'
|
|||
class ShowRegistrarTest < ActionDispatch::IntegrationTest
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
def setup
|
||||
setup do
|
||||
login_as users(:admin)
|
||||
@registrar = registrars(:bestnames)
|
||||
visit admin_registrar_path(@registrar)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class APIDomainTransfersTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
@new_registrar = registrars(:goodnames)
|
||||
Setting.transfer_wait_time = 0 # Auto-approval
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateTransferCodeTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'test_helper'
|
|||
class EppDomainRenewTest < ActionDispatch::IntegrationTest
|
||||
self.use_transactional_fixtures = false
|
||||
|
||||
def setup
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainTransferRequestTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
@new_registrar = registrars(:goodnames)
|
||||
Setting.transfer_wait_time = 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppLoginSessionLimitTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
EppSession.delete_all
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrantDomainsTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
login_as users(:registrant)
|
||||
|
||||
Setting.days_to_keep_business_registry_cache = 1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
WebMock.reset!
|
||||
login_as users(:api_goodnames)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
setup do
|
||||
WebMock.reset!
|
||||
login_as users(:api_goodnames)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ContactTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@contact = contacts(:john)
|
||||
end
|
||||
|
||||
|
|
|
@ -12,11 +12,16 @@ class ContactIdenticalTest < ActiveSupport::TestCase
|
|||
org_name
|
||||
]
|
||||
|
||||
def setup
|
||||
setup do
|
||||
@original_address_processing = Setting.address_processing
|
||||
@contact = contacts(:william)
|
||||
@identical = contacts(:identical_to_william)
|
||||
end
|
||||
|
||||
teardown do
|
||||
Setting.address_processing = @original_address_processing
|
||||
end
|
||||
|
||||
def test_returns_identical
|
||||
assert_equal @identical, @contact.identical(@identical.registrar)
|
||||
end
|
||||
|
@ -33,30 +38,24 @@ class ContactIdenticalTest < ActiveSupport::TestCase
|
|||
assert_nil @contact.identical(@identical.registrar)
|
||||
end
|
||||
|
||||
def test_takes_address_into_account_when_processing_enabled
|
||||
def test_takes_address_into_account_when_address_processing_is_on
|
||||
Setting.address_processing = true
|
||||
|
||||
Contact.address_attribute_names.each do |attribute|
|
||||
previous_value = @identical.public_send(attribute)
|
||||
@identical.update_attribute(attribute, 'other')
|
||||
|
||||
Contact.stub :address_processing?, true do
|
||||
assert_nil @contact.identical(@identical.registrar)
|
||||
end
|
||||
|
||||
assert_nil @contact.identical(@identical.registrar)
|
||||
@identical.update_attribute(attribute, previous_value)
|
||||
end
|
||||
end
|
||||
|
||||
def test_ignores_address_when_processing_disabled
|
||||
def test_ignores_address_when_address_processing_is_off
|
||||
Setting.address_processing = false
|
||||
|
||||
Contact.address_attribute_names.each do |attribute|
|
||||
previous_value = @identical.public_send(attribute)
|
||||
@identical.update_attribute(attribute, 'other')
|
||||
|
||||
Contact.stub :address_processing?, false do
|
||||
assert_equal @identical, @contact.identical(@identical.registrar)
|
||||
end
|
||||
|
||||
assert_equal @identical, @contact.identical(@identical.registrar)
|
||||
@identical.update_attribute(attribute, previous_value)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ContactPostalAddressTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@original_address_processing = Setting.address_processing
|
||||
@contact = contacts(:john)
|
||||
end
|
||||
|
||||
teardown do
|
||||
Setting.address_processing = @original_address_processing
|
||||
end
|
||||
|
||||
def test_invalid_if_country_code_is_invalid_and_address_processing_is_on
|
||||
Setting.address_processing = true
|
||||
@contact.country_code = 'invalid'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ContactTransferTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@contact = contacts(:john)
|
||||
@new_registrar = registrars(:goodnames)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainTransferableTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
@new_registrar = registrars(:goodnames)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainTransferTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@domain_transfer = domain_transfers(:shop)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppSessionTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@epp_session = epp_sessions(:api_bestnames)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MessageTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@message = messages(:greeting)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NameserverGlueRecordTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@nameserver = nameservers(:shop_ns1)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NameserverTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@nameserver = nameservers(:shop_ns1)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarCodeTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@registrar = registrars(:bestnames).dup
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DeleteRegistrarTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@registrar = registrars(:not_in_use)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
setup do
|
||||
@registrar = registrars(:bestnames)
|
||||
end
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@ class ActiveSupport::TestCase
|
|||
|
||||
ActiveRecord::Migration.check_pending!
|
||||
fixtures :all
|
||||
|
||||
teardown do
|
||||
travel_back
|
||||
end
|
||||
end
|
||||
|
||||
class ActionDispatch::IntegrationTest
|
||||
|
@ -28,8 +32,9 @@ class ActionDispatch::IntegrationTest
|
|||
include Capybara::Minitest::Assertions
|
||||
include AbstractController::Translation
|
||||
|
||||
def teardown
|
||||
teardown do
|
||||
Warden.test_reset!
|
||||
WebMock.reset!
|
||||
Capybara.reset_sessions!
|
||||
Capybara.use_default_driver
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue