1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

unit test for the XML namespace handling workaround

This commit is contained in:
Tomasz Bak 2013-01-10 09:09:53 -08:00 committed by geemus
parent 262fd7986b
commit 31dac0b63b

View file

@ -43,14 +43,35 @@ posuere eu odio. Donec sodales, ante porta condimentum
<key3>value3</key3>
</MyObject>
<MyResponse>
}
@xmlNS = %{
<myns:MyResponse>
<myns:MyObject>
<myns:key1>value1</myns:key1>
<myns:key2>value2</myns:key2>
<myns:myArray>
<myns:id>1</myns:id>
<myns:id>2</myns:id>
<myns:id>3</myns:id>
</myns:myArray>
<myns:longText>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec quis metus arcu, quis cursus turpis.
Aliquam leo lacus, luctus vel iaculis id,
posuere eu odio. Donec sodales, ante porta condimentum
</myns:longText>
<myns:key3>value3</myns:key3>
</myns:MyObject>
<myns:MyResponse>
}
@response = {
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'myArray' => [1,2,3],
'longText' => %{
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'myArray' => [1,2,3],
'longText' => %{
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec quis metus arcu, quis cursus turpis.
Aliquam leo lacus, luctus vel iaculis id,
@ -58,10 +79,15 @@ posuere eu odio. Donec sodales, ante porta condimentum
}
}
tests('TestParser').returns(@response, "returns the response") do
test_parser = TestParser.new
Nokogiri::XML::SAX::Parser.new(test_parser).parse(@xml)
test_parser.response
end
tests('TestParser for namespaces').returns(@response, "returns the response") do
test_parser = TestParser.new
Nokogiri::XML::SAX::Parser.new(test_parser).parse(@xmlNS)
test_parser.response
end
end