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

MG mykhaylo.gavrylyuk at gmail.com
Wed Sep 22 15:52:54 EDT 2010


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


More information about the rspec-users mailing list