lib/rubocop/cop/mixin/minitest_exploration_helpers.rb in rubocop-minitest-0.34.0 vs lib/rubocop/cop/mixin/minitest_exploration_helpers.rb in rubocop-minitest-0.34.1
- old
+ new
@@ -97,19 +97,21 @@
node.each_descendant(:send).count do |send_node|
assertion_method?(send_node)
end
end
+ # rubocop:disable Metrics/CyclomaticComplexity
def assertion_method?(node)
- return assertion_method?(node.expression) if node.assignment?
+ return assertion_method?(node.expression) if node.assignment? && node.respond_to?(:expression)
return false if !node.send_type? && !node.block_type? && !node.numblock_type?
ASSERTION_PREFIXES.any? do |prefix|
method_name = node.method_name
method_name.start_with?(prefix) || node.method?(:flunk)
end
end
+ # rubocop:enable Metrics/CyclomaticComplexity
def lifecycle_hook_method?(node)
node.def_type? && LIFECYCLE_HOOK_METHODS.include?(node.method_name)
end
end