Skip to content

Instantly share code, notes, and snippets.

@johnwake
Created August 1, 2012 19:01
Show Gist options
  • Save johnwake/3229812 to your computer and use it in GitHub Desktop.
Save johnwake/3229812 to your computer and use it in GitHub Desktop.
BDD Cucumber example Feature File
Feature: greeter says hello
In order to start learning RSpec and Cucumber
As a reader of The RSpec Book
I want a greeter to say Hello
Scenario: Greeter says hello
Given a greeter
When I send it the greet message
Then I should see "Hello Cucumber!"
class CucumberGreeter
def greet
"Hello Cucumber!"
end
end
Given /^a greeter$/ do
@greeter = CucumberGreeter.new
end
When /^I send it the greet message$/ do
@message = @greeter.greet
end
Then /^I should see "([^"]*)"$/ do |greeting|
@message.should == greeting
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment