[rspec-users] nested describe blocks

David Chelimsky dchelimsky at gmail.com
Thu Oct 4 19:40:54 EDT 2007


On 10/4/07, Zach Dennis <zach.dennis at gmail.com> wrote:
> In 1.0.8 I am able to nest describe blocks, but in moving to trunk,
> revision 2971, I am unable to have the expected results.  Here is an
> example nested describe block:
>
> describe "foo" do
>   describe "with no arguments" do
>     before do
>       puts "a"
>     end
>
>     it "should" do
>       puts "SHOULD"
>     end
>   end
>
>   describe "with invalid arguments" do
>     before do
>       puts "b"
>     end
>
>     it "shouldn't" do
>       puts "SHOULDN'T"
>     end
>   end
> end
>
> Here is the output in trunk (revision 2971):
>
> a
> b
> SHOULD
> a
> b
> SHOULDN'T
>
> Here is the output with 1.0.8:
>
> a
> SHOULD
> b
> SHOULDN'T
>
> The 1.0.8 output is what I expect. I don't believe this is a *feature*
> of rspec in the first place, just an not-so-ordinary way to organize
> some specs. Any chance of having this work as I expect?

We've had years of discussions about this (google for "rspec nested
contexts"). In short, not much chance. The fact that it worked before
was pure luck and never intended. Sorry man.

>
> Zach
>
>
> --
> Zach Dennis
> http://www.continuousthinking.com
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list