test/unit/peddler/test_xml_parser.rb in peddler-1.5.0 vs test/unit/peddler/test_xml_parser.rb in peddler-1.6.0
- old
+ new
@@ -1,9 +1,11 @@
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,
@@ -11,16 +13,21 @@
'Content-Type' => 'text/xml',
'Content-Length' => body.size.to_s
}
)
- @parser = Peddler::XMLParser.new(res)
+ @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