[rspec-users] Cucumber - Adding a step definition

Matt Wynne matt at mattwynne.net
Sat Mar 14 08:59:27 EDT 2009


On 13 Mar 2009, at 21:47, aslak hellesoy wrote:

>
>
> On Fri, Mar 13, 2009 at 10:28 PM, Tim Hart <THart at picagroup.com>  
> wrote:
> List,
>
> Quick question about Cucumber/Gherkin.
>
> I'm considering adding 'With' as a step definition to support  
> scenarios like:
>
> Given a policy
> With a PCF practice state
> And a secondary risk
> ...
>
> I'm fairly new to ruby - but I can't quite get this one figured out.  
> I've tried adding
>
> Cucumber.alias_steps (['With'])
>
> To my features/support/env.rb file, but when I run cucumber, I still  
> get a Syntax error. It looks like my 'with' never gets added to the  
> original list.
>
> Unfortunately, this only aliases the ruby methods (this will let you  
> call With /some step/ do..end in a step definition ruby file.
> In order to make the plain text parser recognise other words, a  
> change is needed in languages.yml.
>
> If you add a feature request in Lighthouse I'll see if I can add it.

I'm not sure if I like this - dependency between steps seems like a  
dodgy road to go down.

When you're in a step definition, how would you know what object the  
'With' was referring to?

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com



More information about the rspec-users mailing list