-
-
Save masaki/3698917 to your computer and use it in GitHub Desktop.
Implementation of Webrat's #table_at for using with Capybara. Not the cleanest implementation ever, but it works correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def table_at(selector) | |
Nokogiri::HTML(page.body).css(selector).map do |table| | |
table.css('tr').map do |tr| | |
tr.css('td').map { |td| td.text.strip } | |
end | |
end[0].reject(&:empty?) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment