lib/rubocop/cop/mixin/minitest_exploration_helpers.rb in rubocop-minitest-0.30.0 vs lib/rubocop/cop/mixin/minitest_exploration_helpers.rb in rubocop-minitest-0.31.0
- old
+ new
@@ -32,11 +32,11 @@
def test_case?(node)
return false unless (node&.def_type? && test_method?(node)) ||
(node&.block_type? && test_block?(node))
class_ancestor = node.each_ancestor(:class).first
- test_class?(class_ancestor)
+ class_ancestor && test_class?(class_ancestor)
end
def test_cases(class_node, visibility_check: true)
test_methods = class_def_nodes(class_node).select do |def_node|
test_method?(def_node, visibility_check: visibility_check)
@@ -98,10 +98,10 @@
assertion_method?(send_node)
end
end
def assertion_method?(node)
- return false if !node.send_type? && !node.block_type?
+ return false if !node.send_type? && !node.block_type? && !node.numblock_type?
ASSERTION_PREFIXES.any? do |prefix|
method_name = node.method_name
# TODO: Remove the fllowing `to_s` since Ruby 2.7 that supports `Symbol#start_with?`.