Sha256: 691a9f5058d507ce849ef559b24cb9f553f82e5d0228cff9c51c497f82da71a8

Contents?: true

Size: 879 Bytes

Versions: 5

Compression:

Stored size: 879 Bytes

Contents

require File.join(File.dirname(__FILE__), '../test_helper.rb')

class AddressTest < Test::Unit::TestCase

  test "build and parse XML" do
    address = create_test_address

    # Generate the XML message
    address_xml = address.to_xml

    # Parse the XML message and retrieve the address element
    address_element = REXML::XPath.first(REXML::Document.new(address_xml), "/Address")

    # Build a new contact from the XML
    result_address = XeroGateway::Address.from_xml(address_element)

    # Check the contact details
    assert_equal address, result_address
  end

  private

    def create_test_address
      XeroGateway::Address.new(
        line_1:       "25 Taranaki St",
        line_2:       "Te Aro",
        city:         "Wellington",
        post_code:    "6011",
        country:      "New Zealand",
        attention_to: "Hashigo Zake"
      )
    end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xero_gateway-2.7.0 test/unit/address_test.rb
xero_gateway-2.6.0 test/unit/address_test.rb
xero_gateway-2.5.0 test/unit/address_test.rb
xero_gateway-2.4.0 test/unit/address_test.rb
xero_gateway-2.3.0 test/unit/address_test.rb