lib/rubocop/cop/mixin/predicate_assertion_handleable.rb in rubocop-minitest-0.19.1 vs lib/rubocop/cop/mixin/predicate_assertion_handleable.rb in rubocop-minitest-0.20.0
- old
+ new
@@ -8,11 +8,15 @@
MSG = 'Prefer using `%<assertion_type>s_predicate(%<new_arguments>s)`.'
RESTRICT_ON_SEND = %i[assert].freeze
def on_send(node)
return unless (arguments = peel_redundant_parentheses_from(node.arguments))
- return unless arguments.first.respond_to?(:predicate_method?) && arguments.first.predicate_method?
- return unless arguments.first.arguments.count.zero?
+
+ first_argument = arguments.first
+
+ return if first_argument.block_type? || first_argument.numblock_type?
+ return unless first_argument.respond_to?(:predicate_method?) && first_argument.predicate_method?
+ return unless first_argument.arguments.count.zero?
add_offense(node, message: offense_message(arguments)) do |corrector|
autocorrect(corrector, node, arguments)
end
end