Sha256: 38b2bf9db274e553d9a7db5a8326d187eb8462c3f185f05d84ec049292736a5f

Contents?: true

Size: 709 Bytes

Versions: 7

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

require 'helper'
require 'peddler/xml_parser'

class TestPeddlerXMLParser < MiniTest::Test
  Parser = Class.new(::Peddler::XMLParser)

  def setup
    body = '<Foo>Bar</Foo>'

    res = OpenStruct.new(
      body: body,
      headers: {
        'Content-Type' => 'text/xml',
        'Content-Length' => body.size.to_s
      }
    )

    @parser = Parser.new(res)
  end

  def test_does_not_implement_parsing
    assert_raises(NotImplementedError) do
      @parser.parse
    end
  end

  def test_digs_data
    @parser.instance_variable_set :@data, foo: { bar: :baz }
    assert_equal :baz, @parser.dig(:foo, :bar)
  end

  def test_validates
    assert @parser.valid?
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
peddler-2.0.4 test/unit/peddler/test_xml_parser.rb
peddler-2.0.3 test/unit/peddler/test_xml_parser.rb
peddler-2.0.0 test/unit/peddler/test_xml_parser.rb
peddler-1.6.7 test/unit/peddler/test_xml_parser.rb
peddler-1.6.6 test/unit/peddler/test_xml_parser.rb
peddler-1.6.5 test/unit/peddler/test_xml_parser.rb
peddler-1.6.4 test/unit/peddler/test_xml_parser.rb