-
Notifications
You must be signed in to change notification settings - Fork 2
Cucumber Steps
peakpg edited this page Feb 7, 2012
·
3 revisions
A quick reference guide to help to writing step definitions.
# Scenario
Given a page exists at /some-path
# Step Definition
Given /^a page exists at (.+)$/ do |path|
@page = Factory(:page, :path=>path)
end
# Scenario
Given a rails engine named "browsercms" should exist
# Step Definition
Then /^a rails engine named "([^"]*)" should exist$/ do |engine_name|
Matches on valid path like characters (which removes the need for double quotes) and allows for words after the path.
# Scenario
Given a page exists at /some-path with:
# Step Definition
Given /^a page exists at ([\/|\w|-]+) with:$/ do |path|