[rspec-users] Documentation for Plain-Text Stories

Jim Morris ml at e4net.com
Wed Aug 20 01:04:57 EDT 2008

Aslak Hellesøy wrote:

> Right now the scope of Before/After is global - i.e. all Before and 
> After blocks will run before and after each scenario. I have 
> deliberately postponed adding scoping of this until I better understand 
> how people want to define this scoping.
> Here is one ideas:
> class MySteps < Cucumber::Steps # Same as Story runnner steps_for(:my)
>   Before do
>     # This block will run before all scenarios that use steps from MySteps
>     # Any scenarios not using any of these will not have this block run
>   end
>   Given /bla bla/ do
>   end
> end
> I'm open to other ideas too.

I'd like to have a before story and after story as well as a before scenario and after scenario.

Right now I do global setup for a story, and cleanup when the story is done. I also do a setup 
before each scenario as well.

It would be nice to have the ability to do both.


Jim Morris, http://blog.wolfman.com

More information about the rspec-users mailing list