Catch argumentless matchers in RSpec/ExpectActual#2171
Conversation
|
|
||
| it 'ignores `be` with no argument' do | ||
| expect_no_offenses(<<~RUBY) | ||
| it 'flags `be` with no argument' do |
There was a problem hiding this comment.
This case wasn't supported only to simplify implementation afaict (see #858)
bquorning
left a comment
There was a problem hiding this comment.
Thank you for the PR, I think it will be a useful addition. I have added a few comments.
Also, I would prefer if the first commit was extracting the method #register_offense (without next if expected.nil?) so that the 2nd commit clearly shows what the actual change is.
|
All done! |
|
@cvx Could I ask you to rebase on top of the latest master branch please? |
Flags e.g. `expect(".foo").to be_present` and `expect(1).to be`.
|
Done! |
|
Are there real life examples of this? |
|
My guess is that offenses would reveal typos, where people are testing literals instead of variables. E.g. they would change |
Flags e.g.
expect(".foo").to be_presentandexpect(1).to be.Before submitting the PR make sure the following are checked:
master(if not - rebase it).CHANGELOG.mdif 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).