-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from xero-gateway/add-attention-to-for-addresses
adds attention to field to contact addresses
- Loading branch information
Showing
3 changed files
with
78 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters