Skip to content

Instantly share code, notes, and snippets.

@vgrichina
Created January 20, 2011 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgrichina/788359 to your computer and use it in GitHub Desktop.
Save vgrichina/788359 to your computer and use it in GitHub Desktop.
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I visit the calculator page
And I fill in '50' for 'first'
And I fill in '70' for 'Second'
When I press 'Add'
Then I should see 'Answer: 120'
Given /^I visit the calculator page$/ do
visit '/add'
end
Given /^I fill in '(.*)' for '(.*)'$/ do |value, field|
fill_in(field, :with => value)
end
When /^I press '(.*)'$/ do |name|
click_button(name)
end
Then /^I should see '(.*)'$/ do |text|
body.should match(/#{text}/m)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment