Skip to content

Commit

Permalink
Merge pull request #1985 from rubocop/revert-unwanted-change
Browse files Browse the repository at this point in the history
Revert an change that would conceal unintentional RSpec syntax
  • Loading branch information
ydah authored Oct 26, 2024
2 parents 530af44 + 6cbe423 commit 6584b4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Fix `RSpec/VoidExpect` to only operate inside an example block. ([@corsonknowles])
- Change `RSpec/ContextWording` cop to always report an offense when both `Prefixes` and `AllowedPatterns` are empty. ([@ydah])
- Fix an error for `RSpec/ChangeByZero` when `change (...) .by (0)` and `change (...)`, concatenated with `and` and `or`. ([@ydah])
- Add support for `and` and `or` compound matchers to `RSpec/ChangeByZero` cop. ([@ydah])

## 3.1.0 (2024-10-01)

Expand Down
5 changes: 1 addition & 4 deletions lib/rubocop/cop/rspec/change_by_zero.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,8 @@ def register_offense(node, change_node)
# rubocop:enable Metrics/MethodLength

def compound_expectations?(node)
if node.parent.send_type?
node.parent.send_type? &&
%i[and or & |].include?(node.parent.method_name)
else
node.parent.and_type? || node.parent.or_type?
end
end

def message(change_node)
Expand Down

0 comments on commit 6584b4a

Please sign in to comment.