lib/rubocop/cop/rspec/nested_groups.rb in rubocop-rspec-1.9.0 vs lib/rubocop/cop/rspec/nested_groups.rb in rubocop-rspec-1.9.1

- old
+ new

@@ -89,15 +89,12 @@ MSG = 'Maximum example group nesting exceeded'.freeze def_node_search :find_contexts, ExampleGroups::ALL.block_pattern - def on_block(node) - describe, = described_constant(node) - return unless describe - - find_nested_contexts(node) do |context| + def on_top_level_describe(node, _) + find_nested_contexts(node.parent) do |context| add_offense(context.children.first, :expression) end end private @@ -111,10 +108,10 @@ end end end def max_nesting - Integer(cop_config.fetch('MaxNesting', 2)) + Integer(cop_config.fetch('MaxNesting', 3)) end end end end end