[rspec-users] AfterCurrentScenario block
matt at mattwynne.net
Fri Apr 17 18:00:02 EDT 2009
On 17 Apr 2009, at 18:20, Aslak Hellesøy wrote:
> Den 17. april. 2009 kl. 18.58 skrev Zach Dennis
> <zach.dennis at gmail.com>:
>> On Fri, Apr 17, 2009 at 12:31 PM, Aslak Hellesøy
>> <aslak.hellesoy at gmail.com> wrote:
>>> Den 17. april. 2009 kl. 18.06 skrev Matt Wynne <matt at mattwynne.net>:
>>>> Is there currently a way to register a block to run after the
>>>> scenario completes?
>> After is used after *any* scenario completes thought, right? If you
>> add an After block inside of a step definition, it's going to be
> Aha now I understand. Matt, would Joseph's suggestion work for you?
It would work, yes, but I have to say I like ours a bit better - you
can put the undo code right next to the code it's undoing, as Zach
pointed out. With the tags thing I'd have to put a tag in the feature
file which is introducing a tiny bit more coupling and noise which I'd
I had pondered on the idea of changing the After method to use a
syntax a bit like RSpec's #before(:each) where we could say:
# general post-scenario clean-up
# one-time clean-up
Anyway, just a thought.
More information about the rspec-users