[rspec-users] Is this a bug? (before(:all) and after(:all) are run for each subcontext)

David Chelimsky dchelimsky at gmail.com
Wed Sep 22 23:46:34 EDT 2010


On Sep 22, 2010, at 2:52 PM, MG wrote:

> Rspec version is 1.3.0
> 
> Given following spec code:
> 
>    describe "SomeModule" do
>      before(:all) { puts "BEFORE" }
>      after(:all)  { puts "AFTER"; puts }
> 
>      context "One" do
>        it "should puts A" do puts "A" end
>        it "should puts B" do puts "B" end
>      end
> 
>      context "Two" do
>        it "should puts C" do puts "C" end
>        it "should puts D" do puts "D" end
>      end
>    end
> 
> It results in following output:
> 
>    BEFORE
>    C
>    .D
>    .AFTER
> 
>    BEFORE
>    A
>    .B
>    .AFTER

It is a known issue in 1.3, but it will not be fixed in the 1.x series.

It does work as you expect in 2.0.

Cheers,
David


More information about the rspec-users mailing list