Switch to `receive` message expectation syntax #7067
Simplify spec for FormatterSet
This line: expect(formatter_set).to all(have_received(:started).with(files)) previously was expect(formatter_set).to all(receive(:started).with(files)) but was triggering a RSpec/SubjectStub offence, and there was a special case treatment introduced to `rubocop-rspec` to relax detection of stubbing when `all` matcher is used together with a message expectation matcher. The cop is not at the moment able to detect `have_received` matcher, but there is an open pull request to improve the detection. That pull request (rubocop-hq/rubocop-rspec#770) is also aiming to remove that special case treatment, because, as experiment has shown, across [`real-world-ruby-apps`](https://github.com/jeromedalbert/real-world-ruby-apps) and [`real-world-rails`](https://github.com/eliotsykes/real-world-rails), there is no other offences detected apart from this `FormatterSet` spec. In any case, the rest of the spec don't use `all`, and are explicit of which object the expectation is made against (by using ``, ``). Also, using spies is not justified in this case. It doesn't make much sense to use a `before` hook that is only run along with a single example.
- Loading branch information...
ProTip! Use n and p to navigate between commits in a pull request.
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.