[rspec-users] [Cucumber] Fail a scenario from After or AfterStep

Matt Wynne matt at mattwynne.net
Wed May 20 09:19:42 EDT 2009

On 20 May 2009, at 09:33, aslak hellesoy wrote:

>> On 20 May 2009, at 00:04, aslak hellesoy wrote:
>>>> Any further thoughts on this, Aslak? I'd prefer to go with a  
>>>> solution in
>>>> line with the future direction of Cucumber if possible.
>>> Sorry, forgot to get back to you Luke.
>>> I'm convinced. We'll add an AfterStep hook. Do you want to give a  
>>> stab
>>> at a patch? Start by writing a feature - see
>>> features/after_block_exceptions.feature for a good example of the
>>> style we like...
>> Can I make a mild plea for After(:step) rather than AfterStep? I  
>> think it
>> looks nicer and it's one less method added to the API...
> That would be confusing, since After already takes arguments (tags).

So why not make the API be like

After(:scenario_tagged => "@emails") { clean_up_emails }
After(:each_scenario) { clean_up_database } #the default
After(:step) { do_stuff_for_luke }

Having less methods makes the protocol more extensible, IMO.

Matt Wynne

More information about the rspec-users mailing list