Assert_tag errors (probably only XML-related)


#1

Hi,

I’m having problems using assert_tag to test XML output.

I have the following functional test for RSS feeds using assert_tag:
assert_tag :tag => “rss”, :child => { :tag => “channel”,
:child => { :tag => “item”,
:child => { :tag => “enclosure”,
:attributes => {:url => ‘http://images-eu.amazon.com/
images/P/3608952128.03.MZZZZZZZ.jpg’ }}}}

With RSS this function has two problems. First it treats some tags
special resulting in errors like

ignoring attempt to close item with link
opened at byte 1635, line 40
closed at byte 1683, line 41
attributes at open: {}
text around open: “”/>\n \n \n h"
text around close: “st.host/media/show/1\n <title”

I could solve that by overwriting HTML::Tag::childless? for XML tests.

Now there is a different mistake:

ignoring attempt to close enclosure with item
opened at byte 578, line 14
closed at byte 665, line 15
attributes at open: {“url”=>“http://images-eu.amazon.com/images/P/
3258058032.03.MZZZZZZZ.jpg”}
text around open: "00Z</dc:date>\n <enclosure url=“http”
text around close: “MZZZZZZZ.jpg”/>\n \n \n "

The offending code looks like this:

http://test.host/media/show/10 Wolf Linder: Schweizerische Demokratie - Institutionen, Prozesse, Perspektiven pneff Switzerland Politics 2005-05-09T02:00Z

It seems as if assert_tag is not able to handle empty elements
(<enclosure … /> here).

I also run into bugs when I run the functional tests of typo.

Has anyone else experienced this behaviour? Am I doing something
wrong, is this a problem with my system configuration (OS X, pre-
installed ruby), is it a known bug or should I commit a new bug for it.

I also tested against trunk in subversion with the same results.

Thank you,
Patrice Neff