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

Corey Haines coreyhaines at gmail.com
Thu Dec 27 11:30:35 EST 2007

I'm working on a series going over the source code for rspec, and I ran into
something interesting with ExampleGroup and SharedExampleGroup. I was
wondering if anyone could shed light on it.
[NOTE: I'm working through the code for my own edification in learning Ruby.
Ruby has some features that I think are incredibly cool, so I'm using a
concrete implementation (RSpec) as a learning tool to see them implemented.
Along the way, I figured I would ask questions that were confusing  to me.
So, please bear with me and please please please do not take this as

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

If there is some hidden meaning, I'd love to hear it. I'll post it as an
update to the blog entry, too.

Oh, and here are the links to the first few parts of the series if anyone is
interested: It looks like I'll be able to get about a post a week on it.

part 1:

part 2:

part 3:
part 4: I'm working on this, which is where I noticed the
ExampleGroup/SharedExampleGroup thing.


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/1820a1ba/attachment.html 

More information about the rspec-users mailing list