Forum: Ruby on Rails assert HTML table contents

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
85de428f7dfe6f826db39f46aa91ef89?d=identicon&s=25 mfuller (Guest)
on 2005-11-14 20:37
(Received via mailing list)
Hello,

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}}
end

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?

Thanks.
This topic is locked and can not be replied to.