Fix namespaces for Zeitwerk class loader

This commit is contained in:
Alex Sherman 2021-03-05 18:00:45 +05:00
parent 32634c7a8b
commit 43b3033991
78 changed files with 666 additions and 704 deletions

View file

@ -7,7 +7,7 @@ class VersionsTest < ActiveSupport::TestCase
@nameserver.update(hostname: 'ns99.bestnames.test')
@ignored_column_title = Nameserver.ignored_columns.first
version = NameserverVersion.last
version = Version::NameserverVersion.last
hash = version.object
hash[@ignored_column_title] = 123456
version.update(object: hash)

View file

@ -6,8 +6,8 @@ class ArchivableContactTest < ActiveSupport::TestCase
end
def test_contact_is_archivable_when_it_was_linked_and_inactivity_period_has_passed
DomainVersion.stub(:was_contact_linked?, true) do
DomainVersion.stub(:contact_unlinked_more_than?, true) do
Version::DomainVersion.stub(:was_contact_linked?, true) do
Version::DomainVersion.stub(:contact_unlinked_more_than?, true) do
assert @contact.archivable?
end
end
@ -18,7 +18,7 @@ class ArchivableContactTest < ActiveSupport::TestCase
@contact.created_at = Time.zone.parse('2010-07-05 00:00:00')
travel_to Time.zone.parse('2010-07-05 00:00:01')
DomainVersion.stub(:was_contact_linked?, false) do
Version::DomainVersion.stub(:was_contact_linked?, false) do
assert @contact.archivable?
end
end
@ -28,14 +28,14 @@ class ArchivableContactTest < ActiveSupport::TestCase
@contact.created_at = Time.zone.parse('2010-07-05')
travel_to Time.zone.parse('2010-07-05')
DomainVersion.stub(:contact_unlinked_more_than?, false) do
Version::DomainVersion.stub(:contact_unlinked_more_than?, false) do
assert_not @contact.archivable?
end
end
def test_contact_is_not_archivable_when_it_was_ever_linked_but_linked_within_inactivity_period
DomainVersion.stub(:was_contact_linked?, true) do
DomainVersion.stub(:contact_unlinked_more_than?, false) do
Version::DomainVersion.stub(:was_contact_linked?, true) do
Version::DomainVersion.stub(:contact_unlinked_more_than?, false) do
assert_not @contact.archivable?
end
end
@ -73,7 +73,7 @@ class ArchivableContactTest < ActiveSupport::TestCase
def archivable_contact
contact = contacts(:john)
Setting.orphans_contacts_in_months = 0
DomainVersion.delete_all
Version::DomainVersion.delete_all
other_contact = contacts(:william)
assert_not_equal other_contact, contact

View file

@ -15,7 +15,7 @@ class RegistrantVerificationTest < ActiveSupport::TestCase
registrant_verification = registrant_verifications(:one)
random_action = "random#{rand(100)}"
assert_difference -> { RegistrantVerificationVersion.count } do
assert_difference -> { Version::RegistrantVerificationVersion.count } do
registrant_verification.update_attributes!(action: random_action)
end
end
@ -23,11 +23,11 @@ class RegistrantVerificationTest < ActiveSupport::TestCase
def test_reject_changes
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
verification_token: @token)
start_versions_count = RegistrantVerificationVersion.count
start_versions_count = Version::RegistrantVerificationVersion.count
assert_nothing_raised do
@registrant_verification.domain_registrant_change_reject!("email link, #{@initiator}")
end
assert_equal RegistrantVerificationVersion.count, start_versions_count + 1
assert_equal Version::RegistrantVerificationVersion.count, start_versions_count + 1
end
end

View file

@ -11,7 +11,7 @@ class DomainVersionTest < ActiveSupport::TestCase
tech_contacts: [],
registrant: [@contact.id] })
assert DomainVersion.was_contact_linked?(@contact.id)
assert Version::DomainVersion.was_contact_linked?(@contact.id)
end
def test_was_contact_linked_returns_true_when_contact_was_used_as_admin_contact
@ -19,7 +19,7 @@ class DomainVersionTest < ActiveSupport::TestCase
tech_contacts: [],
registrant: [] })
assert DomainVersion.was_contact_linked?(@contact.id)
assert Version::DomainVersion.was_contact_linked?(@contact.id)
end
def test_was_contact_linked_returns_true_when_contact_was_used_as_tech_contact
@ -27,7 +27,7 @@ class DomainVersionTest < ActiveSupport::TestCase
tech_contacts: [@contact.id],
registrant: [] })
assert DomainVersion.was_contact_linked?(@contact.id)
assert Version::DomainVersion.was_contact_linked?(@contact.id)
end
def test_was_contact_linked_returns_false_when_contact_was_not_used
@ -35,7 +35,7 @@ class DomainVersionTest < ActiveSupport::TestCase
tech_contacts: [],
registrant: [] })
assert_not DomainVersion.was_contact_linked?(@contact.id)
assert_not Version::DomainVersion.was_contact_linked?(@contact.id)
end
def test_contact_unlinked_more_than_returns_true_when_contact_was_linked_as_registrant_more_than_given_period
@ -45,7 +45,7 @@ class DomainVersionTest < ActiveSupport::TestCase
registrant: [@contact.id] })
travel_to Time.zone.parse('2010-07-05 00:00:01')
assert DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
assert Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
end
def test_contact_unlinked_more_than_given_period_as_admin_contact
@ -55,7 +55,7 @@ class DomainVersionTest < ActiveSupport::TestCase
registrant: [] })
travel_to Time.zone.parse('2010-07-05 00:00:01')
assert DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
assert Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
end
def test_contact_unlinked_more_than_given_period_as_tech_contact
@ -65,7 +65,7 @@ class DomainVersionTest < ActiveSupport::TestCase
registrant: [] })
travel_to Time.zone.parse('2010-07-05 00:00:01')
assert DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
assert Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
end
def test_contact_linked_within_given_period_as_registrant
@ -75,7 +75,7 @@ class DomainVersionTest < ActiveSupport::TestCase
registrant: [@contact.id] })
travel_to Time.zone.parse('2010-07-05')
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
end
def test_contact_linked_within_given_period_as_admin_contact
@ -85,7 +85,7 @@ class DomainVersionTest < ActiveSupport::TestCase
registrant: [] })
travel_to Time.zone.parse('2010-07-05')
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
end
def test_contact_linked_within_given_period_as_tech_contact
@ -95,11 +95,11 @@ class DomainVersionTest < ActiveSupport::TestCase
registrant: [] })
travel_to Time.zone.parse('2010-07-05')
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
end
def test_contact_was_never_linked
DomainVersion.delete_all
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
Version::DomainVersion.delete_all
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
end
end

View file

@ -14,7 +14,7 @@ class ArchiveContactsTaskTest < ActiveSupport::TestCase
def archivable_contact
contact = contacts(:john)
Setting.orphans_contacts_in_months = 0
DomainVersion.delete_all
Version::DomainVersion.delete_all
other_contact = contacts(:william)
assert_not_equal other_contact, contact

View file

@ -42,7 +42,7 @@ EInvoice.provider = EInvoice::Providers::TestProvider.new
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
fixtures :all
set_fixture_class log_domains: DomainVersion
set_fixture_class log_domains: Version::DomainVersion
teardown do
travel_back