[rspec-users] ExampleGroup and SharedExampleGroup relationship(?)

Corey Haines coreyhaines at gmail.com
Thu Dec 27 12:36:25 EST 2007


Thanks to both Pat and Scott for the first two comments. I'm digesting what
you are saying. I'll take these ideas (and any others that come) and try to
summarize them in and upcoming post.

Thanks.
-Corey

On Dec 27, 2007 12:21 PM, Pat Maddox <pergesu at gmail.com> wrote:

> On Dec 27, 2007 8:30 AM, Corey Haines <coreyhaines at gmail.com> wrote:
> > I expected to see SharedExampleGroup < ExampleGroup, but, instead, I saw
> > SharedExampleGroup < Module. This is incredibly confusing to me. I
> realize
> > that they don't even need to have any relationship to each other since
> they
> > get their shared functionality through the module ExampleGroupMethods,
> but
> > it still seems a bit odd to me that they don't have a hierarchical
> > relationship.
>
> Whenever you write an example, RSpec defines a method.  Shared example
> groups are basically sugary modules.  They define examples - methods -
> that get included into your "real" example groups.
>
> I can't say for sure if there's any deeper meaning to it other than
> it's the simplest implementation.  It would be possible to make
> SharedExampleGroup be a class, but then when an ExampleGroup uses
> it_should_behave_like, it would have to list all the examples in the
> SharedExampleGroup, define methods on itself that delegate to the
> SEG...as opposed to just mixing in a module :)
>
> I admit I'm pulling all of this out of my ass, btw, but I think it's
> right.  I'm sure David will clarify soon.
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
http://www.coreyhaines.com
The Internet's Premiere source of information about Corey Haines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071227/9c020bf8/attachment.html 


More information about the rspec-users mailing list