[rspec-users] DRYer controller specs

nicholas a. evans nick at ekenosen.net
Fri Apr 27 12:15:06 EDT 2007


On 4/27/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> Very nice! The trick is that we're merging to concepts here - trying
> to express the intent of the example and also have it execute the
> right things in the right order. Words like "during" or "on" are there
> to coerce rspec to execute things in the right order but they mean the
> same thing to me in terms of expressing the example - the "when" in
> GWT. I'd love to come up with words that serve both execution and
> expression equally. Any other ideas?

It seems to be a hard problem...

Ideas for before_event:
 * during_event

I really like that one, and I can't come up with anything better... to
me it communicates the execution order.

Ideas for after_event:
 * with_event
 * by_the_end_of_event
 * by_event
 * upon_event

PeopleController should assign new person to template with a GET to create
PeopleController should assign new person to template by the end of a
GET to create
PeopleController should assign new person to template upon a GET to create

(I added changed the event string to "a GET to create".)

Both "upon" and "by_the_end_of it" seem evident to me that the
expectations would need to run after the event.  Is it getting closer
to something good?

-- 
Nick


More information about the rspec-users mailing list