Skip to content

Instantly share code, notes, and snippets.

@JonKernPA
Created November 9, 2010 19:28
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 JonKernPA/669649 to your computer and use it in GitHub Desktop.
Save JonKernPA/669649 to your computer and use it in GitHub Desktop.
Simple Cucumber Example
# under features
Feature: Registration Management
Once an organizer creates a season, they can open it up for registrants to sign up.
Scenario: Add a Registration Setup
Given the "My Season" season for "Malvern YMCA"
When I add a setup for "My Season"
Then I should be able to signup under "My Season"
Scenario: Require Parent Info at Signup
Given the "Little League" season for "Malvern YMCA"
When I add a setup for "Little League" requiring Parent Info
Then Registrants will be required to enter parent info
# under features/step_definitions
Given /^the "([^"]*)" season for "([^"]*)"$/ do |season, org|
@org = Organization.create(:name => org)
@season = Season.create( :name => season )
@org.seasons << @season
visit root_path
click_link season
end
When /^I add a setup for "([^"]*)"$/ do |setup|
click_link "Add Registration Setup"
fill_in 'registration_setup_title' , :with => setup
click_button "Create"
end
Then /^I should be able to signup under "([^"]*)"$/ do |season|
visit root_path
click_link season
click_link "Sign-up"
response.should contain("New Member Sign Up")
end
When /^I add a setup for "([^"]*)" requiring Parent Info$/ do |setup|
click_link "Add Registration Setup"
fill_in 'registration_setup_title' , :with => setup
check 'registration_setup_parent_info'
click_button "Create"
end
Then /^Registrants will be required to enter parent info$/ do
visit root_path
click_link @season.name
click_link "Sign-up"
# save_and_open_page
response.should contain("Parent")
end
# under features/support
puts "Clearing entire test database!"
MongoMapper.database.collections.each do |coll|
puts "\tremoving: #{coll.name}"
coll.remove
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment