Sha256: 42d7ec2238c2a2273dc0acc4488754780018f15f033c99f274020b9d71c32f08

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 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_that_it_does_not_implement_parsing
    assert_raises(NotImplementedError) do
      @parser.parse
    end
  end

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

  def test_validation
    assert @parser.valid?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
peddler-2.1.1 test/unit/peddler/test_xml_parser.rb
peddler-2.1.0 test/unit/peddler/test_xml_parser.rb