Skip to content
This repository was archived by the owner on Jul 20, 2026. It is now read-only.

Cucumber DSL

lkhoward edited this page Mar 11, 2016 · 4 revisions

Huzzah includes a few helper methods for use with Cucumber. You will need to explicitly include the module in Cucumber's world:

World(Huzzah::Cucumber::DSL)

The as method allows you to dynamically reference a role within a Cucumber step definition. For example:

# Step
When "Dedric" sends a payment of "5.00" to "carey.braun@okon.co"

# Step Definition
When(/^"([^"]*)" sends a payment of "([^"]*)" to "([^"]*)"$/) do |from_role, amount, to_email|
  as(from_role).payment.send_to(to_email, amount)
end

Huzzah provides a method to close all browsers for all instantiated roles:

After do
  close_browsers
end

Although not part of the Huzzah::Cucumber::DSL module, there are a couple of other methods that may come in handy when working with Cucumber:

user = Huzzah::Role.new

# Dynamically call a site
# user.on(:site_method)
user.on(:moolah)

# Dynamically call a page
# user.moolah.on(:page_method)
user.moolah.on(:user_account)

Clone this wiki locally