Class: RuboCop::Cop::RSpec::NestedGroups
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::RSpec::NestedGroups
- Includes:
- RSpec::Language, RSpec::SpecOnly, RSpec::TopLevelDescribe
- Defined in:
- lib/rubocop/cop/rspec/nested_groups.rb
Overview
Checks for nested example groups.
This cop is configurable using the ‘MaxNesting` option
Constant Summary collapse
- MSG =
'Maximum example group nesting exceeded'.freeze
Constants included from RSpec::SpecOnly
RSpec::SpecOnly::DEFAULT_CONFIGURATION
Constants included from RSpec::Language
Instance Method Summary collapse
Methods included from RSpec::SpecOnly
Methods included from RSpec::TopLevelDescribe
Instance Method Details
#on_block(node) ⇒ Object
98 99 100 101 102 103 104 105 |
# File 'lib/rubocop/cop/rspec/nested_groups.rb', line 98 def on_block(node) describe, = described_constant(node) return unless describe find_nested_contexts(node) do |context| add_offense(context.children.first, :expression) end end |