lib/rubocop/cop/mixin/minitest_exploration_helpers.rb in rubocop-minitest-0.34.1 vs lib/rubocop/cop/mixin/minitest_exploration_helpers.rb in rubocop-minitest-0.34.2
- old
+ new
@@ -97,21 +97,22 @@
node.each_descendant(:send).count do |send_node|
assertion_method?(send_node)
end
end
- # rubocop:disable Metrics/CyclomaticComplexity
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def assertion_method?(node)
+ return false unless node
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
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def lifecycle_hook_method?(node)
node.def_type? && LIFECYCLE_HOOK_METHODS.include?(node.method_name)
end
end