[rspec-users] calling multiline steps from other steps

Ben Mabey ben at benmabey.com
Fri Dec 5 01:53:33 EST 2008


Andrew Premdas wrote:
> Given /^I have filled in the form$/ do |details|
>  details.hashes.each |pair|
>
> Can't see this working because you've got no place to collect details
>
> However
>
> Given /^I have filled in the form with (.*)$/ do |details|
>  details.hashes.each |pair|
>
> would work, but you'd have to do some tricky stuff to get your hash out.
>
<snip>
>
> but I doubt that would work as I think you need the "More Examples:" 
> statement. Also don't think embedding tables in step definitions is a 
> good idea.
>

Actually, you can embed tables in steps, they are called "Step Tables". 
:)  Read about them here:
http://github.com/aslakhellesoy/cucumber/wikis/using-fit-tables-in-a-feature

I have used them many times and I find them very handy.  I had rolled my 
own with story runner and so having it built into cucumber makes things 
very nice.

-Ben



More information about the rspec-users mailing list