require 'minitest/autorun'
require 'qbxml'
class XmlToHashTest < Minitest::Test
def test_xml_to_hash
qbxml = Qbxml.new
h = {"qbxml"=>{"xml_attributes"=>{}, "qbxml_msgs_rq"=>{"xml_attributes"=>{}, "customer_query_rq"=>{"xml_attributes"=>{}, "list_id"=>"GUID-GOES-HERE"}}}}
assert_equal h, qbxml.from_qbxml("\n\n \n \n GUID-GOES-HERE\n \n \n\n")
end
def test_array_of_strings
qbxml = Qbxml.new
h = {
"qbxml" => {
"xml_attributes" => {},
"qbxml_msgs_rq" => {
"xml_attributes" => {},
'invoice_query_rq' => {
"xml_attributes" => {},
'include_ret_element' => ['TxnID', 'RefNumber']
}
}
}
}
assert_equal h, qbxml.from_qbxml("\n\n \n \n TxnID\n RefNumber\n \n \n\n")
end
end