Skip to content

Commit

Permalink
Protect against missing parent node
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Apr 9, 2022
1 parent 09883e5 commit d1c4ab2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rubocop/cop/minitest/duplicate_test_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ def on_class(class_node)

def parent_class_has_test_methods?(class_node)
parent_class = class_node.parent_class
parent_class_node = class_node.parent.each_child_node(:class).detect do |klass|

return false unless (class_node_parent = class_node.parent)

parent_class_node = class_node_parent.each_child_node(:class).detect do |klass|
klass.identifier == parent_class
end

Expand Down

0 comments on commit d1c4ab2

Please sign in to comment.