[rspec-users] Step matchers

Tom Stuart tom at experthuman.com
Mon Oct 15 06:45:43 EDT 2007


On 15 Oct 2007, at 10:25, Wincent Colaiuta wrote:
> - The customer/client (not necessarily with any programming
> knowledge) writes the stories in a format which is (almost) plain  
> text.
> - The developer then writes custom "step matchers"; where do they go?
> - How much of parsing can be generalized and done by RSpec itself
> without requiring the developer to spend too much time writing the
> matchers?

I'm a bit sceptical about all this (not to suggest that Wincent  
necessarily is!). I don't fully grasp the implications of the  
proposal either but superficially it smells like using a sledgehammer  
to crack the rather straightforward nut of having something that  
works like string interpolation.

What's the problem with the alternating 'string', parameter,  
'string', parameter, 'string' syntax? It might be less aesthetically  
beautiful than punctuation-free plain text but conceptually it  
expresses exactly what you're trying to achieve without all of that  
tedious mucking about with matching. I'm biased, I suppose; as a Ruby  
programmer a big part of the conceptual beauty of examples comes from  
them being written in native code, so I'd be sad to see that go out  
of the window with scenarios, but I appreciate the pull of the  
customer-facing aspect. Regardless I believe (without evidence) that  
trying to pretend we're doing something fundamentally different to  
writing a program when constructing a scenario is a recipe for  
confusion at best, and the "but customers will balk at apostrophes  
and commas!" sentiment feels slightly too specious to justify it.

Cheers,
-Tom


More information about the rspec-users mailing list