Is this a bug? (before(:all) and after(:all) are run for each subcontext)

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

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

   it "should puts B" do puts "B" end

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs