3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/toothbrush/helpers.rb', line 3
def ensure_table(table_selector, , content = nil)
if content.nil?
return _ensure_table(table_selector, )
else
=
end
content.each_with_index do |row, row_index|
row.each_with_index do |cell, cell_index|
begin
within("#{table_selector} tbody tr:nth-child(#{row_index+1}) td:nth-child(#{cell_index+1})") do
page.should have_content(cell)
end
rescue Capybara::ElementNotFound
within("#{table_selector} tr:nth-child(#{row_index+2}) td:nth-child(#{cell_index+1})") do
page.should have_content(cell)
end
end
end
end
end
|