lib/rubocop/cop/minitest/refute_operator.rb in rubocop-minitest-0.32.0 vs lib/rubocop/cop/minitest/refute_operator.rb in rubocop-minitest-0.32.1
- old
+ new
@@ -18,10 +18,11 @@
MSG = 'Prefer using `refute_operator(%<new_arguments>s)`.'
RESTRICT_ON_SEND = %i[refute].freeze
def on_send(node)
- return unless node.first_argument.operator_method?
+ first_argument = node.first_argument
+ return unless first_argument.respond_to?(:operator_method?) && first_argument.operator_method?
new_arguments = build_new_arguments(node)
add_offense(node, message: format(MSG, new_arguments: new_arguments)) do |corrector|
corrector.replace(node.loc.selector, 'refute_operator')