[rspec-users] Best practices for sharing state between story steps?
ml at e4net.com
Tue Sep 9 14:28:27 EDT 2008
Dan North wrote:
> Hi Jim.
> I guess I'm not a purist then - that looks fine to me, and it's probably
> something I would consider doing too.
I'd never call you a purist Dan ;) But I do feel less dirty now, although after reading Aslaks post
I wonder what exactly is meant by stateless steps? It seems to me that you have to set some kind of
variable between steps to communicate what was done in one and what needs to be checked in another.
Having been guilty of writing unit tests that were not stateless (ie one unit test depended on the
result of a previous one, which BTW I really avoid doing), I did not consider setting variables
between steps to be stateful.
> scenario steps themselves. Perhaps not. In the latter case I would
> definitely go with $globals to communicate state into your scenario, as
> long as you promise never to use them in your application code. Never,
> you hear me?
Hmmm well OK I'll try to never use them ;)
Jim Morris, http://blog.wolfman.com
More information about the rspec-users