rubocop-rspec
rubocop-rspec copied to clipboard
Require VoidExpect to operate inside an example block
This PR completes branch coverage for VoidExpect
.
This PR copies the inside_example?
method and re-uses it here to get more coherent behavior from the VoidExpect cop.
Note that if we were thinking of copying inside_example?
a 3rd time, I'd suggest factoring it out into a utility (Sandi Metz' rule of 3).
Note that I remove the return true unless parent
guard clause, because we expect the inside_example?
guard clause to fully cover that condition.
Split from:
- https://github.com/rubocop/rubocop-rspec/pull/1972
Before submitting the PR make sure the following are checked:
- [x] Feature branch is up-to-date with
master
(if not - rebase it). - [x] Squashed related commits together.
- [x] Added tests.
- [x] Updated documentation.
- [x] Added an entry to the
CHANGELOG.md
if the new code introduces user-observable changes. - [x] The build (
bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).
If you have created a new cop:
- [ ] Added the new cop to
config/default.yml
. - [ ] The cop is configured as
Enabled: pending
inconfig/default.yml
. - [ ] The cop is configured as
Enabled: true
in.rubocop.yml
. - [ ] The cop documents examples of good and bad code.
- [ ] The tests assert both that bad code is reported and that good code is not reported.
- [ ] Set
VersionAdded: "<<next>>"
indefault/config.yml
.
If you have modified an existing cop's configuration options:
- [ ] Set
VersionChanged: "<<next>>"
inconfig/default.yml
.