Sha256: df1d5482614bf6042b17eec0ded9cec6cb3f990dda888d21278db56b788f014b
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true require 'helper' require 'peddler/xml_response_parser' class TestPeddlerXMLResponseParser < MiniTest::Test def test_parsing_responses body = '<Response><Result><Foo>Bar</Foo></Result></Response>' parser = Peddler::XMLResponseParser.new(response(body)) assert_equal 'Bar', parser.parse['Foo'] end def test_parsing_messages body = '<Response><MessageType>ProcessingReport</MessageType><Message><Foo>Bar</Foo></Message></Response>' parser = Peddler::XMLResponseParser.new(response(body)) assert_equal 'Bar', parser.parse['Foo'] end def test_parsing_reports body = '<fooReports><fooReport><foo>Bar</foo></fooReport></fooReports>' parser = Peddler::XMLResponseParser.new(response(body)) assert_equal 'Bar', parser.parse['foo'] end def test_parsing_next_token body = '<Response><Result><NextToken>123</NextToken></Result></Response>' 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
peddler-2.1.1 | test/unit/peddler/test_xml_response_parser.rb |
peddler-2.1.0 | test/unit/peddler/test_xml_response_parser.rb |