Fix discarded domains test

This commit is contained in:
Alex Sherman 2021-02-01 16:52:38 +05:00
parent 38b7e52ac8
commit fc3a764896
2 changed files with 10 additions and 8 deletions

View file

@ -11,6 +11,13 @@ module Concerns::Contact::Identical
ident_country_code ident_country_code
org_name org_name
] ]
IDENTICAL_ATTRIBUTES = %w[
ident
ident_type
ident_country_code
]
private_constant :IDENTIFIABLE_ATTRIBUTES private_constant :IDENTIFIABLE_ATTRIBUTES
def identical(registrar) def identical(registrar)
@ -21,7 +28,7 @@ module Concerns::Contact::Identical
end end
def identical_to?(contact) def identical_to?(contact)
IDENTIFIABLE_ATTRIBUTES.all? do |attribute| IDENTICAL_ATTRIBUTES.all? do |attribute|
self.attributes[attribute] == contact.attributes[attribute] self.attributes[attribute] == contact.attributes[attribute]
end end
end end

View file

@ -9,12 +9,7 @@ class APIDomainAdminContactsTest < ApplicationIntegrationTest
@admin_new.update(ident: @admin_current.ident, @admin_new.update(ident: @admin_current.ident,
ident_type: @admin_current.ident_type, ident_type: @admin_current.ident_type,
ident_country_code: @admin_current.ident_country_code, ident_country_code: @admin_current.ident_country_code)
name: @admin_current.name,
email: @admin_current.email,
phone: @admin_current.phone,
fax: @admin_current.fax,
org_name: @admin_current.org_name)
end end
def test_replace_all_admin_contacts_when_ident_data_doesnt_match def test_replace_all_admin_contacts_when_ident_data_doesnt_match
@ -49,7 +44,7 @@ class APIDomainAdminContactsTest < ApplicationIntegrationTest
new_contact_id: @admin_new.code }, new_contact_id: @admin_new.code },
headers: { 'HTTP_AUTHORIZATION' => http_auth_key } headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
assert domains(:shop).admin_contacts.find_by(code: @admin_current.code) assert domains(:airport).admin_contacts.find_by(code: @admin_current.code)
end end
def test_return_affected_domains_in_alphabetical_order def test_return_affected_domains_in_alphabetical_order