More multi failures
Created by: myronmarston
This PR addresses a bunch of deficiencies I found in how rspec-core handles aggregate_failures
. This includes a fix for #1966 (closed), although the bigger fix is for how it handles a case like this:
it "has failures", :aggregate_failures do
expect(x).to eq(2)
raise_if_x_is_not_2(x)
end
Previously, the error from the last method call was reported as the example's main exception and the expect(x).to eq(2)
failure was reported using a "An error occurred in an around
hook" message, which was confusing and generally a bad experience. The problem was that aggregate_failures
handles any exceptions that happen within the block, but when using metadata it wraps rspec-core's handling of errors so the failure aggregator doesn't see the error that happens. I had to change how we handle aggregate_failures
a bit to deal with this.
I also introduced a RSpec::Core::MultipleExceptionError
to more generally handle multiple exceptions for one example.
Finally, pending
interacted weirdly with aggregate_failures
so I dealt with that, too.
Note that this builds on top of rspec/rspec-expectations#800.
I'm hoping to release 3.3 once this is merged.
/cc @rspec/rspec