New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new RSpec/AvoidSetupHook cop #1133
Add new RSpec/AvoidSetupHook cop #1133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setup allows expectations inside a block
before
allows that as well. 🤫
Thanks for the contribution. A few small tweaks and I'm happy to accept it!
CircleCI status reports for partially degraded service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
Rebased, moved to |
f13f8d2
to
077754e
Compare
We're more relying on the Community RSpec style guide that has this rule with single expectation relaxed. See rubocop/rspec-style-guide#47 for more info. Also, |
Checked against
Two offences were off:
Fixed. |
14eda53
to
2f92ed8
Compare
2f92ed8
to
e94b463
Compare
Thank you, @paydaylight ! |
BTW would you like to hack on |
Added new cop
RSpec/Rails/AvoidSetupHook
that checks that rspec'sbefore
method is used over rspec-rails'setup
.setup
calls without arguments that are basicallybefore
method calls.Setup allows expectations inside a block that are counterintuitive and make tests do two things at a time which is badBefore submitting the PR make sure the following are checked:
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.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:
config/default.yml
.Enabled: pending
inconfig/default.yml
.VersionAdded
indefault/config.yml
to the next minor version.If you have modified an existing cop's configuration options:
VersionChanged
inconfig/default.yml
to the next major version.