Forum: Ruby on Rails assert HTML table contents

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.
mfuller (Guest)
on 2005-11-14 21:37
(Received via mailing list)

Is there a nice was to assert the contents of HTML table?

I could do this:

def get_table_tag(table_id)
  {:tag => 'table', :attributes => {:id => table_id}}

assert_tag :tag =>"td", :content => "cell content", :parent => {:tag
=>'tr', :parent => get_table_tag(table_id)}

But even doing this only proves there is a cell with "cell content"
anywhere in the table. It does not proves it's in the right row or
column. I suppose I could use the :sibling condition but it seems the
assert would become rather ugly.

Coming from Java using jWebUnit I could do:
assertTableRowsEqual(java.lang.String tableSummaryOrId, int startRow,
java.lang.String[][] expectedCellValues)

Is there anything similiar?

This topic is locked and can not be replied to.