[rspec-users] Step matchers

David Chelimsky dchelimsky at gmail.com
Sun Oct 14 18:39:20 EDT 2007

On 10/14/07, Pat Maddox <pergesu at gmail.com> wrote:
> I think we all know that the readability of steps isn't great right
> now, and in fact there's a very recent thread that discusses just
> that.  It was that recent thread that prompted me to explore this a
> bit.
> The basic idea is that you define step matchers, which have a regex,
> and then you match step names against that regex.  Kind of tough for
> me to explain so I'll just link to some code :)
> spec: http://pastie.caboo.se/107116
> impl: http://pastie.caboo.se/107117
> Instead of writing
> Given "a user named __ who is __ years old", "Pat Maddox", 22
> it allows you to write
> Given "a user named Pat Maddox who is 22 years old"
> I wrote it out as a separate matcher because it was just easiest to do
> it that way while I explored this approach, no messing around with
> RSpec internals to get it to really work.  However if we went this
> route the structure would certainly be different.
> Hopefully you can get the idea from the example code.  Ideally what I
> would like is to write step libraries that are external to the stories
> themselves.  The stories would be much clearer because the
> implementation would not be embedded, and the step names themselves
> would make a lot more sense.
> wdyt?

LOL - I just suggested something like this in the other thread you
cite. Though your idea strikes me as far more flexible and usable.
Well done!!!!


> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list