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

aslak hellesoy aslak.hellesoy at gmail.com
Thu May 21 07:46:12 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.
>

What you suggest would break backwards compatibility.
I actually think that one method makes the protocol *less* extensible,
since there will always be compatibility issues.

Besides, I actually think Before(*tags), After(*tags) and
AfterStep(*tags) is more readable.
In any case, you don't have to write this a lot, only a couple of
times per project.

So we'll stick with the current API

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