Created
April 21, 2011 19:56
-
-
Save hynkle/935341 to your computer and use it in GitHub Desktop.
step definition for table rows in cucumber w/ capybara
This file contains 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
# The overall effect of this is to assert that there exists a row where all of the strings | |
# specified can be found in one of its tds. | |
# | |
# Then I should see "foo" and "bar" within a row | |
# Then I should see "foo", "bar", and "baz" within a row | |
Then /^I should see ((?:"(?:[^"]+)"(?: |, | and |, and ))*"(?:[^"]+)") (?:within|in) a row$/ do |list| | |
cell_xpaths = list.scan(/"(?:[^"])+"/).map{|cell_content| %(td/descendant-or-self::*[text()=#{cell_content}])} | |
page.should have_xpath %{//tr/#{cell_xpaths.join %(/ancestor::tr[1]/)}} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment