Skip to content

Instantly share code, notes, and snippets.

@mikeymckay
Created July 27, 2010 20:16
Show Gist options
  • Save mikeymckay/492792 to your computer and use it in GitHub Desktop.
Save mikeymckay/492792 to your computer and use it in GitHub Desktop.

Revisions

  1. mikeymckay created this gist Jul 27, 2010.
    25 changes: 25 additions & 0 deletions Valid Capybara Cucumber Statements
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    When /^(?:|I )go to (.+)$/ do |page_name|
    When /^(?:|I )press "([^\"]*)"(?: within "([^\"]*)")?$/ do |button, selector|
    When /^(?:|I )follow "([^\"]*)"(?: within "([^\"]*)")?$/ do |link, selector|
    When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, value, selector|
    When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
    # When I fill in the following:
    When /^(?:|I )fill in the following(?: within "([^\"]*)")?:$/ do |selector, fields|
    When %{I fill in "#{name}" with "#{value}"}
    When /^(?:|I )select "([^\"]*)" from "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
    When /^(?:|I )check "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
    When /^(?:|I )uncheck "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
    When /^(?:|I )choose "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
    When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"(?: within "([^\"]*)")?$/ do |path, field, selector|
    Then /^(?:|I )should see JSON:$/ do |expected_json|
    Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
    Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
    Then /^(?:|I )should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
    Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
    Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain "([^\"]*)"$/ do |field, selector, value|
    Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should not contain "([^\"]*)"$/ do |field, selector, value|
    Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should be checked$/ do |label, selector|
    Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should not be checked$/ do |label, selector|
    Then /^(?:|I )should be on (.+)$/ do |page_name|
    Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
    Then /^show me the page$/ do