Module: RuboCop::Cop::RSpec::TopLevelGroup

Extended by:
NodePattern::Macros
Included in:
DescribeClass, DescribeMethod, InstanceVariable, MultipleDescribes, NestedGroups, RepeatedSubjectCall, SpecFilePathFormat, SpecFilePathSuffix, SubjectStub
Defined in:
lib/rubocop/cop/rspec/mixin/top_level_group.rb

Overview

Helper methods for top level example group cops

Instance Method Summary collapse

Instance Method Details

#on_new_investigationObject



10
11
12
13
14
15
16
17
# File 'lib/rubocop/cop/rspec/mixin/top_level_group.rb', line 10

def on_new_investigation
  super

  top_level_groups.each do |node|
    on_top_level_example_group(node) if example_group?(node)
    on_top_level_group(node)
  end
end

#top_level_groupsObject



19
20
21
22
# File 'lib/rubocop/cop/rspec/mixin/top_level_group.rb', line 19

def top_level_groups
  @top_level_groups ||=
    top_level_nodes(root_node).select { |n| spec_group?(n) }
end