lib/rubocop/cop/rspec/named_subject.rb in rubocop-rspec-2.22.0 vs lib/rubocop/cop/rspec/named_subject.rb in rubocop-rspec-2.23.0
- old
+ new
@@ -143,10 +143,10 @@
.map { |block_node| find_subject(block_node) }
.find(&:itself)
end
def find_subject(block_node)
- block_node.body.child_nodes.find { |send_node| subject?(send_node) }
+ block_node.body&.child_nodes&.find { |send_node| subject?(send_node) }
end
end
end
end
end