You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevent MultipleExceptionError#add from allowing self to be added to the list of all_exceptions
This was exposed by rspec#2112 which
contains a spec which uses `describe_successfully` which seems to somehow
add the existing `MultipleExceptionError` to itself when it fails. This
**does not happen** if the example passes (presumably because an error
is not generated).
When we format the exception
[here](https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/formatters/exception_presenter.rb#L330)
we use FlatMap, which is going to continuously unpack the exception,
causing infinite recursion.
This patch prevents `MultipleExceptionError::InterfaceTag#add` from
allowing `self` to be included in the `all_exceptions` array. This fixes
the problem.
As far as I can tell from running our suite, the `self` being added case
never actually happens during normal RSpec execution and so adding this
is fine. I added a spec which demonstrates this behaviour in case that
turns out to be problematic in the future. I can't imagine that
happening though as this will precisely cause the same infinite
recursion bug.
0 commit comments