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

Matt Wynne matt at mattwynne.net
Fri Sep 26 07:30:43 EDT 2008

Going back to the debate about keeping state between steps, I found  
myself with the mild urge to be able to write this today:

Given there is a user
And the user has 20 friends
Then I should see a thumbnail of each of the users's friends
Which should be a link to the user profile page for that friend

NB: An idiom in this which may be songkick-only but was inspired by  
what we've read on this list, and worth explaining: "the user" as in  
"the user has 20 friends", means User.first in rails. If there's more  
than one user when this step runs, it will flunk, because the English  
no longer works.

So anyway, what I was thinking was that it would be nice to be able  
to refer to the last thing I said I should be able to see, and  
decorate it with more specification in a subsequent step or steps.

Obviously, I could roll these into one long Then step, but maybe this  
is more elegant...

Just thinking out loud. I have no idea what the steps code would look  



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/82a726be/attachment-0001.html>

More information about the rspec-users mailing list