Skip to content

Commit 6584b4a

Browse files
authored
Merge pull request #1985 from rubocop/revert-unwanted-change
Revert an change that would conceal unintentional RSpec syntax
2 parents 530af44 + 6cbe423 commit 6584b4a

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

99
## 3.1.0 (2024-10-01)
1010

lib/rubocop/cop/rspec/change_by_zero.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,8 @@ def register_offense(node, change_node)
118118
# rubocop:enable Metrics/MethodLength
119119

120120
def compound_expectations?(node)
121-
if node.parent.send_type?
121+
node.parent.send_type? &&
122122
%i[and or & |].include?(node.parent.method_name)
123-
else
124-
node.parent.and_type? || node.parent.or_type?
125-
end
126123
end
127124

128125
def message(change_node)

0 commit comments

Comments
 (0)