test/xmlhasher/parser_test.rb in xmlhasher-0.0.5 vs test/xmlhasher/parser_test.rb in xmlhasher-0.0.6
- old
+ new
@@ -224,9 +224,19 @@
xml = %[<my-tag><MyTag2>content</MyTag2></my-tag>]
expected = {:my_tag => {:my_tag2 => 'content'}}
assert_equal expected, XmlHasher::Parser.new(options).parse(xml)
end
+ def test_snakecasing_string_elements
+ options = {
+ :snakecase => true,
+ :string_keys => true
+ }
+ xml = %[<my-tag><MyTag2>content</MyTag2></my-tag>]
+ expected = {'my_tag' => {'my_tag2' => 'content'}}
+ assert_equal expected, XmlHasher::Parser.new(options).parse(xml)
+ end
+
def test_empty_tag
xml = %[<tag></tag>]
expected = {:tag => nil}
assert_equal expected, XmlHasher::Parser.new.parse(xml)
end