[rspec-users] BDD / cucumber thought - chaining 'Then' steps with Which

Matt Wynne matt at mattwynne.net
Fri Sep 26 09:06:36 EDT 2008

On 26 Sep 2008, at 13:59, Josh Chisholm wrote:

> Stories without shared state feel clunky to me, because we would  
> never speak that way.
> I also had a similar urge, don't know if it's a "programmer" urge:
> Given a user
> With the name 'josh'
> And the password 'sesame'
> ...so I don't end up with an explosion of steps for 'a user with  
> x', 'a user with y', 'a user with x and y' .
> So there are named things, but we also often want to refer to the  
> anonymous "last mentioned thing" like we do in speech. So I end up  
> doing things like this sometimes:
> Given /a user/ do
>   shared_state["he"] = shared_state["she"] = shared_state["it"] =  
> User.new
> end
> ...is that bad?

FWIW, I think it's rather nice. We went through a fad of using @it  
for a while, and now we have a stuff[] hash. Both similar ideas -  
there must be something in this.

Aslak, I'd love to hear a war story about how shared state bit you in  
the arse to give this debate some balance.


In case you wondered: The opinions expressed in this email are my own  
and do not necessarily reflect the views of any former, current or  
future employers of mine.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080926/c833552e/attachment.html>

More information about the rspec-users mailing list