This commit is contained in:
Maciej Szlosarczyk 2020-06-26 22:55:34 +03:00
parent 41d9a36431
commit bc3ea52667
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
2 changed files with 5 additions and 3 deletions

View file

@ -10,7 +10,7 @@ module Deserializers
def call
attributes = {
name: if_present('postalInfo name'),
org: if_present('postalInfo org'),
org_name: if_present('postalInfo org'),
email: if_present('email'),
fax: if_present('fax'),
phone: if_present('voice'),

View file

@ -22,6 +22,7 @@ class DeserializersXmlContactTest < ActiveSupport::TestCase
<contact:chg>
<contact:postalInfo>
<contact:name>new name</contact:name>
<contact:org>Org</contact:org>
</contact:postalInfo>
<contact:voice>+123.4</contact:voice>
<contact:email>new-email@inbox.test</contact:email>
@ -35,8 +36,9 @@ class DeserializersXmlContactTest < ActiveSupport::TestCase
nokogiri_frame = Nokogiri::XML(xml_string).remove_namespaces!
instance = ::Deserializers::Xml::Contact.new(nokogiri_frame)
assert_equal instance.call, { name: 'new name',
email: 'new-email@inbox.test',
phone: '+123.4' }
org_name: 'Org',
email: 'new-email@inbox.test',
phone: '+123.4' }
end
def test_handles_create