Skip to content

Fix before(:all) error handling so that it fails examples in nested groups, too.

Created by: myronmarston

For one of my projects, I had a spec like this:

describe SomeClass do
  before(:all) { ... }

  describe "#some_method" do
    it "does something" do
    end
  end
end

My before(:all) hook started to raise an exception. However, RSpec 2 apparently ignored the error. The it "does something" spec wasn't even run or counted, and no error was reported. I only noticed something was amiss because the example count suddenly dropped by a couple hundred even though I hadn't removed any.

The existing code handled the case of examples being in the same group as the failing before(:all) hook, but did not handle the case of examples being in a sub-group of the group with the failing before(:all) hook. The child specs were simply being ignored.

My commit fixes this.

Merge request reports