cucumber/cucumber — pull request #168 by gga (2011-11-07 08:30:34+00:00)
Title: Methods for Step Definitions

I'd like to be able to write step definitions without attaching a block directly in-line. Like so:

Given /^I am using "([^"]+)" as the payment recipient$/, :select_recipient

Where select_recipient(name) is a method on the current World. Additionally, I'd like to be able to execute the method against any arbitrary object, as long as it could be reach from the World. Like so:

Given /^I am using "([^"]+)" as the payment recipient$/, :select_recipient, :on => lambda { current_user }

Where the lambda under the key :on is executed within the World, and the method is then sent to the returned object.

I feel that using this approach may encourage more maintainable step definition implementations by making it more straightforward to just wire steps up to page and persona objects.