lib/rubocop/cop/minitest/assert_operator.rb in rubocop-minitest-0.32.1 vs lib/rubocop/cop/minitest/assert_operator.rb in rubocop-minitest-0.32.2

- old
+ new

@@ -16,13 +16,17 @@ class AssertOperator < Base extend AutoCorrector MSG = 'Prefer using `assert_operator(%<new_arguments>s)`.' RESTRICT_ON_SEND = %i[assert].freeze + ALLOWED_OPERATORS = [:[]].freeze def on_send(node) first_argument = node.first_argument - return unless first_argument.respond_to?(:operator_method?) && first_argument.operator_method? + return unless first_argument.respond_to?(:binary_operation?) && first_argument.binary_operation? + + operator = first_argument.to_a[1] + return if ALLOWED_OPERATORS.include?(operator) new_arguments = build_new_arguments(node) add_offense(node, message: format(MSG, new_arguments: new_arguments)) do |corrector| corrector.replace(node.loc.selector, 'assert_operator')