[rspec-users] Custom Example Groups
programmer2188 at gmail.com
Sun Apr 19 08:04:04 EDT 2009
> -----Original Message-----
> From: rspec-users-bounces at rubyforge.org [mailto:rspec-users-
> bounces at rubyforge.org] On Behalf Of Pat Maddox
> Sent: Sunday, April 19, 2009 4:10 AM
> To: rspec-users
> Subject: Re: [rspec-users] Custom Example Groups
> Check out http://gist.github.com/97967 - top one is a custom example
> group, and bottom one is accessing an example's instance var from
> within a matcher.
Thank you very much! That helps a lot.
One more question: is it possible to specify that an example group must be
nested within another example group? Say I want to act on controller, so I'd
like it to be within a controller example group. Only thing I can think of
is to check described_class, but are there any other methods? I'd like to
check the class of the group it's nested in.
> On Sat, Apr 18, 2009 at 11:31 PM, Brandon Olivares
> <programmer2188 at gmail.com> wrote:
> > Hi,
> > I want to build a custom example group, but there really aren't any
> > anywhere for how to do so. The new chapter in The RSpec Book talks
> about it,
> > but doesn't actually show an example, only how to register it.
> > Looking at rspec-rails, I can see a pattern, but I don't know if
> > specific to rspec-rails, or if it is what should be done. In rspec-
> rails, it
> > has:
> > Class << self
> > Within the class, and all the methods are within that.
> > So, are there any examples anywhere for how to write an example
> > Also, if I set an instance variable within the example group, will
> > matchers specific to that group be able to access it? That'll
> simplify my
> > design a bit.
> > Thanks,
> > Brandon
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users