Skip to content

Instantly share code, notes, and snippets.

@bmarcot
Last active December 16, 2015 10:19
Show Gist options
  • Save bmarcot/5419334 to your computer and use it in GitHub Desktop.
Save bmarcot/5419334 to your computer and use it in GitHub Desktop.
Then /I should see "(.*)" before "(.*)"/ do |e1, e2|
# ensure that that e1 occurs before e2.
# page.body is the entire content of the page as a string.
assert page.body.index(e1) < page.body.index(e2)
end
Then /I should see "(.*)" before "(.*)"/ do |e1, e2|
# another strategy with regex (see Hints part of the assignments)
page.body.scan(/.*"#{e1}".*"#{e2}".*/).length.should == 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment