Skip to content

Instantly share code, notes, and snippets.

%view
%container(type=“horizontal”)
%textfield#username
%button#ok_button
@greis
greis / gist:1711522
Created January 31, 2012 16:47
Cucumber table diff for partial rows
Then /^the table should contain the following rows:$/ do |table|
table_element = find('table.standard')
headers = table_element.all('thead th').map(&:text)
result = table_element.all('tbody tr').map do |tr|
{}.tap do |hash|
tds = tr.all('td').map(&:text)
headers.each_with_index do |header, i|
hash[header] = tds[i]
end
end