Should honor legacy CID and add registrar prefix

This commit is contained in:
Priit Tark 2015-05-06 15:57:14 +03:00
parent 0a07004633
commit 2bfbf5f4ea
2 changed files with 2 additions and 3 deletions

View file

@ -118,7 +118,6 @@ class Contact < ActiveRecord::Base
# custom code from client
# add prefix when needed
if code.present?
code.sub!(/^CID:/, '')
prefix, *custom_code = code.split(':')
code = custom_code.join(':') if prefix == registrar.code
end

View file

@ -164,12 +164,12 @@ describe 'EPP Contact', epp: true do
response[:result_code].should == '2005'
end
it 'should not add registrar prefix for code when legacy prefix present' do
it 'should add registrar prefix for code when legacy prefix present' do
response = create_request({ id: { value: 'CID:FIRST0:abc:ABC:NEW:12345' } })
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Contact.last.code.should == 'FIRST0:ABC:ABC:NEW:12345'
Contact.last.code.should == 'FIRST0:CID:FIRST0:ABC:ABC:NEW:12345'
end
it 'should not remove suffix CID' do