[rspec-devel] additions to rspec_on_rails

David Chelimsky dchelimsky at gmail.com
Mon Jan 7 03:42:00 EST 2008


On Jan 7, 2008 2:25 AM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Jan 6, 2008 6:13 PM, Rick Olson <technoweenie at gmail.com> wrote:
> > Yehuda Katz and I were brainstorming on a better way to quickly spec
> > rails/merb controllers with rspec and came up with:
> > http://weblog.techno-weenie.net/2007/12/26/controller-specs-are-a-drag.
> >  Basically, we're calling methods off the Example object returned by
> > #it to define common examples.  However, a recent change in rspec
> > (specifically, the combining of Spec::Example and Spec::ExampleGroup
> > objects?) breaks our monkey patches:
> >
> > http://rafb.net/p/AuR1yL64.html
> >
> > Is this something we can get in rspec so that I don't have to mess
> > with a custom subclass?  Subclassing Spec::ExampleGroup wasn't a
> > problem before.  But subclassing Spec::Example is an issue because
> > then I'm not using the subclasses that rspec_on_rails provides.  The
> > change lets an example add a peer example to the current example
> > group.  Just let me know what you want me to do, and I'll work up a
> > patch for the tracker.
>
> I love the idea. If we make it part of rspec it's gotta use 'should'
> instead of active voice:
>
>   it.should_assign ....
>
> Either way, I think this should be managed through a module that RSpec
> exposes as a hook for this sort of thing:
>
> module Spec::ExampleShortcuts
>   def should_assign ... end
> end

Actually, this exists already - we just need to commit to the module name.

Take a look at this: http://pastie.caboo.se/136065

>
> That would make it easier for anyone to extend examples in the way
> that you are doing here with reduced risk. WDYT?
>


More information about the rspec-devel mailing list