[rspec-users] shared behav

Rick DeNatale rick.denatale at gmail.com
Tue Dec 18 17:46:54 EST 2007

On 12/18/07, David Chelimsky <dchelimsky at gmail.com> wrote:

> That's actually as it should be. The common use case for nested is
> that you create something in the outer group and expand its definition
> in the inner group.
> describe Thing do
>   before(:each) { @thing = Thing.new }
>   describe "with special magic powers" do
>     before(:each) { @thing.grant_special_magic_powers }
>     it "should be able to conjure up world peace" do
>       @thing.should be_able_to_conjure_up_world_peace
>     end
>   end
> end
> This requires running the befores in the outer groups first, which is
> the opposite of what your example would require.
> Make sense?

Yes and it helps clarify my questions about how nested groups were
different, if at all, from shared groups.

Rick DeNatale

My blog on Ruby

More information about the rspec-users mailing list