Forum: Ruby on Rails assert_tag errors (probably only XML-related)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
mailinglists (Guest)
on 2005-12-01 03:50
(Received via mailing list)

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 => '
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    </item>\n    <item>\n      <link>h"
   text around close: "</link>\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"=>"
   text around open: "00Z</dc:date>\n      <enclosure url=\"http"
   text around close: "MZZZZZZZ.jpg\"/>\n    </item>\n    <item>\n "

The offending code looks like this:
   <title>Wolf Linder: Schweizerische Demokratie - Institutionen,
Prozesse, Perspektiven</title>
   <dc:subject>Switzerland Politics</dc:subject>
   <enclosure url=\"

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
This topic is locked and can not be replied to.