class RuboCop::Cop::RSpec::RepeatedSubjectCall

def detect_subjects_in_scope(node)

def detect_subjects_in_scope(node)
  node.each_descendant(:block).with_object({}) do |child, h|
    subject?(child) do |name|
      outer_example_group = child.each_ancestor(:block).find do |a|
        example_group?(a)
      end
      (h[outer_example_group] ||= []) << name
    end
  end
end