Assert HTML table contents



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?