Sha256: 7e23eddc46c9b37277c14da6bc982f35d910abe70f4a7ec24ebde8479afaf956

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

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

class TrackingCategoryTest < Test::Unit::TestCase
  # Tests that a tracking category can be converted into XML that Xero can understand, and then converted back to a tracking category
  def test_build_and_parse_xml
    tracking_category = create_test_tracking_category
    
    # Generate the XML message
    tracking_category_as_xml = tracking_category.to_xml

    # Parse the XML message and retrieve the tracking category element
    tracking_category_element = REXML::XPath.first(REXML::Document.new(tracking_category_as_xml), "/TrackingCategory")

    # Build a new tracking category from the XML
    result_tracking_category = XeroGateway::TrackingCategory.from_xml(tracking_category_element)
    
    # Check the tracking category details
    assert_equal tracking_category, result_tracking_category
  end
  
  
  private
  
  def create_test_tracking_category
    tracking_category = XeroGateway::TrackingCategory.new
    tracking_category.name = "REGION"
    tracking_category.options = ["NORTH", "SOUTH", "CENTRAL"]
    tracking_category
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
tlconnor-xero_gateway-1.0.3 test/unit/tracking_category_test.rb
tlconnor-xero_gateway-1.0.4 test/unit/tracking_category_test.rb
xero_gateway-2.0.6 test/unit/tracking_category_test.rb
xero_gateway-2.0.5 test/unit/tracking_category_test.rb
xero_gateway-2.0.4 test/unit/tracking_category_test.rb
xero_gateway-2.0.3 test/unit/tracking_category_test.rb
xero_gateway-2.0.2 test/unit/tracking_category_test.rb