require 'helper' require 'peddler/xml_response_parser' class TestPeddlerXMLResponseParser < MiniTest::Test def test_parses_responses body = 'Bar' parser = Peddler::XMLResponseParser.new(response(body)) assert_equal 'Bar', parser.parse['Foo'] end def test_parses_messages body = 'ProcessingReportBar' parser = Peddler::XMLResponseParser.new(response(body)) assert_equal 'Bar', parser.parse['Foo'] end def test_parses_reports body = 'Bar' parser = Peddler::XMLResponseParser.new(response(body)) assert_equal 'Bar', parser.parse['foo'] end def test_parses_next_token body = '123' parser = Peddler::XMLResponseParser.new(response(body)) assert_equal '123', parser.next_token end private def response(body) OpenStruct.new( body: body, headers: { 'Content-Type' => 'text/xml', 'Content-Length' => body.size } ) end end