Clear RSpec examples without shared examples in similar way as in RSpec 3.6.0 #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should fix Queue Mode for RSpec. This change is based on changes introduced in RSpec 3.6.0 related to the feature:
"Running specs multiple times with different runner options in the same process"
https://relishapp.com/rspec-staging/rspec-core/docs/running-specs-multiple-times-with-different-runner-options-in-the-same-process
rspec/rspec-core#2379
General context
RSpec.clear_examples
in rspec 3.6.0 clears examples without shared examples. That's good because we want to have loaded shared examples between rspec runs.RSpec.clear_examples
in rspec < 3.6.0 clears examples and shared examples. That's bad because the tests fails because shared examples are not loaded.RSpec.clear_examples
does an additional thing which is cleared formatters and report. We don't want that because we want to accumulate info about failed/pending tests so we can show at the very end of Queue Mode output the info about summary of tests (what failed and what's pending).Solution
Instead of using
RSpec.clear_examples
we do exactly the same thing as theRSpec.clear_examples
method in rspec 3.6.0 except we don't clear formatters and report.