Created
November 9, 2010 19:28
-
-
Save JonKernPA/669649 to your computer and use it in GitHub Desktop.
Simple Cucumber Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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