lib/rubocop/cop/minitest/refute_empty.rb in rubocop-minitest-0.5.0 vs lib/rubocop/cop/minitest/refute_empty.rb in rubocop-minitest-0.5.1

- old
+ new

@@ -14,10 +14,12 @@ # # good # refute_empty(object) # refute_empty(object, 'the message') # class RefuteEmpty < Cop + include ArgumentRangeHelper + MSG = 'Prefer using `refute_empty(%<arguments>s)` over ' \ '`refute(%<receiver>s)`.' def_node_matcher :refute_with_empty, <<~PATTERN (send nil? :refute $(send $_ :empty?) $...) @@ -35,14 +37,12 @@ end end def autocorrect(node) lambda do |corrector| - refute_with_empty(node) do |_first_receiver_arg, object, rest_receiver_arg| - message = rest_receiver_arg.first - - replacement = [object.source, message&.source].compact.join(', ') - corrector.replace(node.loc.expression, "refute_empty(#{replacement})") + refute_with_empty(node) do |_, actual_arg| + corrector.replace(node.loc.selector, 'refute_empty') + corrector.replace(first_argument_range(node), actual_arg.source) end end end end end