mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
parent
dbf5c8b4aa
commit
7147144894
8 changed files with 38 additions and 18 deletions
|
@ -48,9 +48,9 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
composed_of :identifier,
|
||||
class_name: 'Contact::Ident',
|
||||
constructor: Proc.new { |code, type, country_code| Contact::Ident.new(code: code,
|
||||
type: type,
|
||||
country_code: country_code) },
|
||||
constructor: proc { |code, type, country_code| Contact::Ident.new(code: code,
|
||||
type: type,
|
||||
country_code: country_code) },
|
||||
mapping: [%w[ident code], %w[ident_type type], %w[ident_country_code country_code]]
|
||||
|
||||
def manage_emails
|
||||
|
|
|
@ -133,7 +133,7 @@ class Epp::Contact < Contact
|
|||
],
|
||||
'2305' => [ # Association exists
|
||||
[:domains, :exist]
|
||||
],
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -165,8 +165,7 @@ class Epp::Contact < Contact
|
|||
|
||||
identifier = Ident.new(code: ident,
|
||||
type: ident_frame.attr('type'),
|
||||
country_code: ident_frame.attr('cc')
|
||||
)
|
||||
country_code: ident_frame.attr('cc'))
|
||||
|
||||
identifier.validate
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ module EPP
|
|||
|
||||
def self.from_xml(xml)
|
||||
xml_doc = Nokogiri::XML(xml)
|
||||
response = self.new
|
||||
response = new
|
||||
|
||||
result_elements = xml_doc.css('result')
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module EPP
|
|||
'2001' => :syntax_error,
|
||||
'2003' => :required_param_missing,
|
||||
'2005' => :param_syntax_error,
|
||||
'2308' => :data_management_policy_violation,
|
||||
'2308' => :data_management_policy_violation
|
||||
}
|
||||
|
||||
attr_accessor :code
|
||||
|
|
|
@ -164,7 +164,7 @@ RSpec.describe Contact::Ident, db: false do
|
|||
describe '::mismatches' do
|
||||
it 'returns mismatches' do
|
||||
mismatches = [
|
||||
Contact::Ident::Mismatch.new('birthday', Country.new('EE')),
|
||||
Contact::Ident::Mismatch.new('birthday', Country.new('EE'))
|
||||
]
|
||||
|
||||
expect(described_class.mismatches).to eq(mismatches)
|
||||
|
|
|
@ -12,7 +12,7 @@ RSpec.describe EPP::Response::Result, db: false do
|
|||
'2001' => :syntax_error,
|
||||
'2003' => :required_param_missing,
|
||||
'2005' => :param_syntax_error,
|
||||
'2308' => :data_management_policy_violation,
|
||||
'2308' => :data_management_policy_violation
|
||||
}
|
||||
|
||||
expect(described_class.codes).to eq(codes)
|
||||
|
|
|
@ -219,7 +219,7 @@ RSpec.describe 'EPP contact:create' do
|
|||
|
||||
before do
|
||||
mismatches = [
|
||||
Contact::Ident::Mismatch.new('priv', Country.new('DE')),
|
||||
Contact::Ident::Mismatch.new('priv', Country.new('DE'))
|
||||
]
|
||||
allow(Contact::Ident).to receive(:mismatches).and_return(mismatches)
|
||||
end
|
||||
|
|
|
@ -37,15 +37,24 @@ RSpec.describe 'EPP contact:update' do
|
|||
let!(:contact) { create(:contact, code: 'TEST', ident: 'test', ident_type: 'priv', ident_country_code: 'US') }
|
||||
|
||||
it 'does not update code' do
|
||||
expect { request; contact.reload }.to_not change { ident.code }
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.code }
|
||||
end
|
||||
|
||||
it 'does not update type' do
|
||||
expect { request; contact.reload }.to_not change { ident.type }
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.type }
|
||||
end
|
||||
|
||||
it 'does not update country code' do
|
||||
expect { request; contact.reload }.to_not change { ident.country_code }
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.country_code }
|
||||
end
|
||||
|
||||
specify do
|
||||
|
@ -90,7 +99,10 @@ RSpec.describe 'EPP contact:update' do
|
|||
}
|
||||
|
||||
it 'does not update code' do
|
||||
expect { request; contact.reload }.to_not change { ident.code }
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.code }
|
||||
end
|
||||
|
||||
it 'updates type' do
|
||||
|
@ -137,15 +149,24 @@ RSpec.describe 'EPP contact:update' do
|
|||
}
|
||||
|
||||
it 'does not update code' do
|
||||
expect { request; contact.reload }.to_not change { ident.code }
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.code }
|
||||
end
|
||||
|
||||
it 'does not update type' do
|
||||
expect { request; contact.reload }.to_not change { ident.type }
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.type }
|
||||
end
|
||||
|
||||
it 'does not update country code' do
|
||||
expect { request; contact.reload }.to_not change { ident.country_code }
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.country_code }
|
||||
end
|
||||
|
||||
specify do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue