Convert a Capybara table to something you can diff with a Cucumber table

  • Download Gist
1 2 3
# change 'table' to a more specific selector when the page will have more than one table
find('table').all('tr').map { |row| row.all('th, td').map { |cell| cell.text.strip } }

Thank you for providing this snippet. I had to call strip on cell.text otherwise it contained line breaks in some cases.

Thanks, @dbloete, I've updated the snippet to include strip.

But Why remove tableish ?

Because tablish isn't as flexible as the Capybara finders and like you see: It's easy to roll it yourself.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.