Story teardowns?

View: New views
4 Messages — Rating Filter:   Alert me  

Story teardowns?

by Andreas Axelsson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Does the plain text story framework support teardowns? There doesn’t seem to be anywhere to put an “after” method. My stories test an application which parses and modifies a directory tree, which is currently generated in a Given-clause, and I want it to be deleted after each story. (I don’t mind if the stories take a few seconds to run, the specs are still fast)

 

Cheers ,

Andreas Axelsson

Combination AB

 


_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: Story teardowns?

by Aslak Hellesoy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jan 11, 2008 10:53 AM, Andreas Axelsson
<Andreas.Axelsson@...> wrote:

>
>
>
>
> Does the plain text story framework support teardowns? There doesn't seem to
> be anywhere to put an "after" method. My stories test an application which
> parses and modifies a directory tree, which is currently generated in a
> Given-clause, and I want it to be deleted after each story. (I don't mind if
> the stories take a few seconds to run, the specs are still fast)
>

There is no such feature (yet). For now I'd stick this in a Given that
you use at the beginning of each scenario, for example:

Given "the stash is in a clean state" do
  # yank any old residual gunk here
end

Aslak

>
>
> Cheers ,
>
> Andreas Axelsson
>
> Combination AB
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@...
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: Story teardowns?

by Andreas Axelsson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > Does the plain text story framework support teardowns? There doesn't
> seem to
> > be anywhere to put an "after" method. My stories test an application
> which
> > parses and modifies a directory tree, which is currently generated in
> a
> > Given-clause, and I want it to be deleted after each story. (I don't
> mind if
> > the stories take a few seconds to run, the specs are still fast)
> >
>
> There is no such feature (yet). For now I'd stick this in a Given that
> you use at the beginning of each scenario, for example:
>
> Given "the stash is in a clean state" do
>   # yank any old residual gunk here
> end

Thanks, that's how I solved it for now.

/Andreas

_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: Story teardowns?

by jesterj :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andreas Axelsson-2 wrote:
> > Does the plain text story framework support teardowns? There doesn't > seem to > > be anywhere to put an "after" method. >For now I'd stick this in a Given that > you use at the beginning of each scenario, for example: > > Given "the stash is in a clean state" do > # yank any old residual gunk here > end
Another option, which I found more helpful, is to add another step like:
   And finally, clean up 
Which enables you to do all the teardown in:
 Then "finally, clean up" do{ teardown_stuff }
-J