Fixes #1961 The problem with using :absolute_file_path is that it doesn't function correctly for shared examples in an external file. The filter manager thinks that there are no location filters set, when actually there are. Since MetadataFilter already handles location filtering correctly across multiple nested examples / files, correcting the path that is checked is sufficient to fix the line filtering issue.
This is necessary for niche situations where `aggregate_failures` is nested.
It is already listed on the aggregate failure backtrace, and would be redundant to list it on each sub-failure.
To get this to work properly, we have to compose the exception presenter options for pending and for MultipleExpectationsNotMetError.
We need to combine some of these cases (such as when we get a `MultipleExpectationsNotMetError` in a pending spec), and to do that we need to combine the options, so having the options listed in the same method is a stepping stone towards that.
- Simplifies the notification classes. - Provides something we can use to format multiple expectation failures packaged as a single exception for `aggregate_failures`.
This will make it easier to extract an `ExceptionFormatter`.
- Remove unnecessary `Array#last` call. - This version is threadsafe, whereas the prior version wasn’t. Consider what would happen if another thread added an example to the `examples` array while this was happening: it would have returned a different example than the one created here. We don’t actually do any multithreading when examples are defined, and have no plans to do so, but it’s always nice to make things more threadsafe.
Accomplish this by no longer clearing the example's ivars. Fixes rspec/rspec-core#1921 Context ------- * This pull request: #1950 * Originally clearing ivars due to memory leak: #321 * Threadsafe memoized helpers caused `__memoized` to stop lazily initializing: #321 * This caused it to be permawiped by by the resetting of the example's ivars: #1921 However, this patch tests the behaviour of the memory leak, rather than its mechanics, which shows that it was fixed at some point. So we simply remove that code.
When a helper module is configured, it is now applied to all existing matching example groups. This means that the order in which example groups are defined and helper modules are configured no longer matters.
We only care that all the failures from the original run are still failing; additional failures can be ignored.