Sha256: 7177597f8948e5cdb86027821c8d7500102aa7ea3d216370b9bf7dd5ad9c4a26

Contents?: true

Size: 677 Bytes

Versions: 4

Compression:

Stored size: 677 Bytes

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
peddler-1.6.3 test/unit/peddler/test_xml_parser.rb
peddler-1.6.2 test/unit/peddler/test_xml_parser.rb
peddler-1.6.1 test/unit/peddler/test_xml_parser.rb
peddler-1.6.0 test/unit/peddler/test_xml_parser.rb