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

Constant Summary collapse

DEPRECATED_MODULE_METHOD_WARNING =
'top_level_group? is deprecated and will be ' \
'removed in the next major version of rubocop_rspec.'

Instance Method Summary collapse

Instance Method Details

#on_new_investigationObject



14
15
16
17
18
19
20
21
# File 'lib/rubocop/cop/rspec/mixin/top_level_group.rb', line 14

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



23
24
25
26
# File 'lib/rubocop/cop/rspec/mixin/top_level_group.rb', line 23

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