mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 04:58:29 +02:00
parent
1ae00382cd
commit
5b4658b905
2 changed files with 44 additions and 23 deletions
|
@ -158,7 +158,11 @@ class Epp::Contact < Contact
|
||||||
# https://github.com/internetee/registry/issues/576
|
# https://github.com/internetee/registry/issues/576
|
||||||
if ident_frame
|
if ident_frame
|
||||||
if identifier.valid?
|
if identifier.valid?
|
||||||
report_valid_ident_error
|
submitted_ident = Ident.new(code: ident_frame.text,
|
||||||
|
type: ident_frame.attr('type'),
|
||||||
|
country_code: ident_frame.attr('cc'))
|
||||||
|
|
||||||
|
report_valid_ident_error if submitted_ident != identifier
|
||||||
else
|
else
|
||||||
ident_update_attempt = ident_frame.text.present? && (ident_frame.text != ident)
|
ident_update_attempt = ident_frame.text.present? && (ident_frame.text != ident)
|
||||||
report_ident_update_error if ident_update_attempt
|
report_ident_update_error if ident_update_attempt
|
||||||
|
|
|
@ -34,7 +34,23 @@ RSpec.describe 'EPP contact:update' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when contact ident is valid' do
|
context 'when contact ident is valid' do
|
||||||
let!(:contact) { create(:contact, code: 'TEST', ident: 'test', ident_type: 'priv', ident_country_code: 'US') }
|
context 'when submitted ident matches current one' do
|
||||||
|
let!(:contact) { create(:contact, code: 'TEST',
|
||||||
|
ident: 'test',
|
||||||
|
ident_type: 'priv',
|
||||||
|
ident_country_code: 'US') }
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(epp_response).to have_result(:success)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when submitted ident does not match current one' do
|
||||||
|
let!(:contact) { create(:contact, code: 'TEST',
|
||||||
|
ident: 'another-test',
|
||||||
|
ident_type: 'priv',
|
||||||
|
ident_country_code: 'US') }
|
||||||
|
|
||||||
it 'does not update code' do
|
it 'does not update code' do
|
||||||
expect do
|
expect do
|
||||||
|
@ -64,6 +80,7 @@ RSpec.describe 'EPP contact:update' do
|
||||||
t('epp.contacts.errors.valid_ident'))
|
t('epp.contacts.errors.valid_ident'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when contact ident is invalid' do
|
context 'when contact ident is invalid' do
|
||||||
let(:contact) { build(:contact, code: 'TEST', ident: 'test', ident_type: nil, ident_country_code: nil) }
|
let(:contact) { build(:contact, code: 'TEST', ident: 'test', ident_type: nil, ident_country_code: nil) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue