[rspec-users] Cucumber - Adding a step definition

Aslak Hellesøy aslak.hellesoy at gmail.com
Sat Mar 14 09:37:43 EDT 2009



Den 14. mars. 2009 kl. 13.59 skrev Matt Wynne <matt at mattwynne.net>:

>
> 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?
>

Good question Matt. Let's clarify this first. Maybe there is a better  
way to express this with the current language.

Aslak
> Matt Wynne
> http://blog.mattwynne.net
> http://www.songkick.com
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list