lib/rubocop/cop/minitest/multiple_assertions.rb in rubocop-minitest-0.35.1 vs lib/rubocop/cop/minitest/multiple_assertions.rb in rubocop-minitest-0.36.0
- old
+ new
@@ -73,10 +73,14 @@
node.each_child_node.sum { |child| assertions_count(child) }
end
end
def assertions_count_in_assignment(node)
- return assertions_count_based_on_type(node.expression) unless node.masgn_type?
+ unless node.masgn_type?
+ return 0 unless node.expression # for-style loop
+
+ return assertions_count_based_on_type(node.expression)
+ end
rhs = node.children.last
case rhs.type
when :array