[rspec-users] Another attempt for a succinct model validation DSL

nicholas a. evans nick at ekenosen.net
Sat Jun 2 10:32:51 EDT 2007


On 6/1/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> Well now we're getting much simpler. Instead of a whole new structure,
> why not just use a custom matcher?
>
> http://pastie.caboo.se/67069

I agree, simpler is better.  I intend to start off with just the
matcher, and then move towards a shortcut syntax.

My nitpick with only doing a matcher and not doing some extras as
well: it's still too verbose for my taste.  For example, I'll be
saying "as(:foo)" for every single example within a behavior, or
wrapping it inside some examples_array.each loops will feel a bit
clunky.  The whole point was to cut away as much of the noise as
possible, and focus only on the examples (and occasionally, the error
messages).

At any rate, I just put together my first draft implementation
(developed spec-first).  It still doesn't check the error messages
yet, and it's only handling single fields at the moment, but I'll do
those after I get home from the market.  After that I'll figure out
how to get it working with my desired "shortcut" syntax.  Then I'll
package it up all nicely for anyone to use... it's all in one file at
the moment, so if you are looking to see the syntax that it enables,
you'll have to scroll down to line 109.  ;-)

http://pastie.caboo.se/67222

I've included the output from "spec -f s" in the pastie.

-- 
Nick


More information about the rspec-users mailing list