test/unit/contact_test.rb in xero_gateway-2.6.0 vs test/unit/contact_test.rb in xero_gateway-2.7.0
- old
+ new
@@ -96,11 +96,11 @@
TESTING
contact_element = REXML::XPath.first(REXML::Document.new(test_xml.gsub(/\s/, "")), "/Contact")
contact = XeroGateway::Contact.from_xml(contact_element)
- assert_equal Time.new(2016, 8, 31, 04, 55, 39), contact.updated_at.utc
+ assert_equal Time.utc(2016, 8, 31, 04, 55, 39), contact.updated_at.utc
end
# Test Contact#add_address helper creates a valid XeroGateway::Contact object with the passed in values
# and appends it to the Contact#addresses attribute.
@@ -161,9 +161,62 @@
:country_code => '61',
:area_code => '406',
:number => '012345678901234567890123456789012345678901234567890'
})
assert(!phone.valid?)
+ end
+
+ def test_loads_branding_theme_if_set
+ test_xml = <<-TESTING.strip_heredoc.chomp
+ <Contact>
+ <ContactID>f1d403d1-7d30-46c2-a2be-fc2bb29bd295</ContactID>
+ <ContactStatus>ACTIVE</ContactStatus>
+ <Name>24 Locks</Name>
+ <Addresses>
+ <Address>
+ <AddressType>POBOX</AddressType>
+ </Address>
+ <Address>
+ <AddressType>STREET</AddressType>
+ </Address>
+ </Addresses>
+ <Phones>
+ <Phone>
+ <PhoneType>DDI</PhoneType>
+ </Phone>
+ <Phone>
+ <PhoneType>DEFAULT</PhoneType>
+ </Phone>
+ <Phone>
+ <PhoneType>FAX</PhoneType>
+ </Phone>
+ <Phone>
+ <PhoneType>MOBILE</PhoneType>
+ </Phone>
+ </Phones>
+ <ContactPersons>
+ <ContactPerson>
+ <FirstName>John</FirstName>
+ <LastName>Smith</LastName>
+ <EmailAddress>john@acme.com</EmailAddress>
+ <IncludeInEmails>true</IncludeInEmails>
+ </ContactPerson>
+ </ContactPersons>
+ <UpdatedDateUTC>2016-08-31T04:55:39.217</UpdatedDateUTC>
+ <IsSupplier>false</IsSupplier>
+ <IsCustomer>false</IsCustomer>
+ <HasAttachments>false</HasAttachments>
+ <BrandingTheme>
+ <BrandingThemeID>3761deb4-209e-4197-80bb-2993aff35387</BrandingThemeID>
+ <Name>Test_Theme</Name>
+ </BrandingTheme>
+ </Contact>
+ TESTING
+
+ contact_element = REXML::XPath.first(REXML::Document.new(test_xml.gsub(/\s/, "")), "/Contact")
+ contact = XeroGateway::Contact.from_xml(contact_element)
+
+ assert_equal "Test_Theme", contact.branding_theme.name
end
private
def create_test_contact