[Rspec-devel] Given,Then,When

Chris Anderson jchris at mfdz.com
Thu Aug 10 13:41:02 EDT 2006


I haven't been mailing the list much, but I have been using rSpec in
some projects and for fun. Most of the discussion about name-change /
syntax changes has been unexciting to me, but this stuff really seems
to hit the nail on the head. Not only does it clean up the
documentation side of things, if it were implemented correctly it
could cut down on a lot of setup code dupliction. I'm imagining
calling out to shared methods in the "given" blocks, so that common
elements of setup can be shared. I think this works because of the
addition of the "when" block, which really makes clear the event
central to defining the behaviour being focussed on in this "spec".

Granted, there is still more to work out in this syntax (eg multiple
given/when/then blocks to specify a deck of cards, etc.)

Hmm... I'm still liking specify - it connotes writing your specs first.

Alot to think about. My two cents as an rSpec user: I'd just like the
framework to be stable soon. If I were confident that the specs I
write now will be useful for the life of my project, I'd probably stop
using test:unit altogether.


On 8/9/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> Fellow rspec'ers:
> One thing lacking in the current rspec syntax is direct support of the
> BDD triad: Given,When,Then. Right now, rspec supports Given in the
> form of contexts and combines When and Then in specify blocks. This
> lends itself well to structural aspects of the code we're specifying
> (i.e. "A standard deck of cards should have 52 cards", but does not do
> a good job of separating out events (When) from expected outcomes
> (Then).

Chris Anderson

More information about the Rspec-devel mailing list