Skip to content

Instantly share code, notes, and snippets.

@ncancelliere
Created January 2, 2010 21:33
Show Gist options
  • Save ncancelliere/267681 to your computer and use it in GitHub Desktop.
Save ncancelliere/267681 to your computer and use it in GitHub Desktop.
## manage_contact.feature (cucumber scenario) ###
Scenario: View list of contacts
Given 3 contacts exist # Pickle makes this line possible
When I go to the contact list
Then I should see 3 contacts
## custom_steps.rb (cucumber step-definition) ###
Then /^(?:|I )should see (\d+) (.*)$/ do |count, selector|
response.should have_selector(".#{selector.singularize}", :count => count.to_i)
end
## index.html.haml (view that's being tested) ###
%h1 Contact List
%table.contacts
%tr
%th Name
%th Email
%th Phone 1
%th Phone 2
- @contacts.each do |contact|
%tr.contact
%td= contact.name
%td= contact.email
%td= contact.phone1
%td= contact.phone2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment