[rspec-devel] first cut at blockless given/when/then

Pat Maddox pergesu at gmail.com
Fri Oct 19 03:42:58 EDT 2007

On 10/18/07, Ian Dees <undees at gmail.com> wrote:
> Hi, Dave.
> > I committed a first cut at blockless Givens/Whens/Thens to RSpec's trunk:
> Nice!
> Thinking out loud for larger projects here....  What's the scope (or
> lifetime -- I'm not sure what to call it) of a step created by
> step_matcher?  How does it know which Story to attach to?

I don't think that's been figured out yet.  I chatted with David a bit
earlier this evening and we were brainstorming a little, but the convo
got cut short.  If you've got ideas I'd love to hear them.

> And a brief heretical thought: does step_matcher really need us to
> specify :given, :when, or :then?  Is there ever a case when two steps
> would have the same name, but one would be a Given and the other would
> be a Then?

I'm not sure there are many cases where step names could clash like
that, but I suppose there could be.  More importantly though, passing
in the type gives clarity.

step_matcher(:given, "an addend of $addend")

stands on its own.  At a glance you can tell that it's used as a
given.  Contrast that with scouring hundreds of lines of

step_matcher("an addend of $addend")
step_matcher("an augend of $augend")
step_matcher("a tightend of $tightend")

it gets painful if you don't have any idea what each one is.  At
least, it would be painful for me.


More information about the rspec-devel mailing list