contact generates code if custom code is empty

This commit is contained in:
Priit Tark 2015-03-27 15:37:39 +02:00
parent c898ad57f5
commit 251231cf3f
2 changed files with 19 additions and 1 deletions

View file

@ -42,7 +42,7 @@ class Epp::Contact < Contact
return super if frame.blank? return super if frame.blank?
custom_code = custom_code =
if frame.css('id').present? if frame.css('id').text.present?
"#{registrar.code}:#{frame.css('id').text.parameterize}" "#{registrar.code}:#{frame.css('id').text.parameterize}"
else else
nil nil

View file

@ -145,6 +145,24 @@ describe 'EPP Contact', epp: true do
Contact.last.code.should == 'registrar1:12345' Contact.last.code.should == 'registrar1:12345'
end end
it 'should generate server id when id is empty' do
response = create_request({ id: { value: '' } })
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Contact.last.code.should_not == 'registrar1:'
end
it 'should generate server id when id is empty' do
response = create_request
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Contact.last.code.should_not == 'registrar1:'
end
it 'should return parameter value policy error for org' do it 'should return parameter value policy error for org' do
response = create_request({ postalInfo: { org: { value: 'should not save' } } }) response = create_request({ postalInfo: { org: { value: 'should not save' } } })
response[:msg].should == response[:msg].should ==