MG
2010-Sep-22 19:52 UTC
[rspec-users] 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
David Chelimsky
2010-Sep-23 03:46 UTC
[rspec-users] Is this a bug? (before(:all) and after(:all) are run for each subcontext)
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 > .AFTERIt 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