Class: RuboCop::Cop::RSpec::DescribedClassModuleWrapping

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/rspec/described_class_module_wrapping.rb

Overview

Avoid opening modules and defining specs within them.

Examples:

# bad
module MyModule
  RSpec.describe MyClass do
    # ...
  end
end

# good
RSpec.describe MyModule::MyClass do
  # ...
end

See Also:

Constant Summary collapse

MSG =
'Avoid opening modules and defining specs within them.'

Instance Method Summary collapse

Methods inherited from Base

inherited, #on_new_investigation

Methods included from RSpec::Language::NodePattern

#block_pattern, #send_pattern

Instance Method Details

#on_module(node) ⇒ Object


27
28
29
30
31
# File 'lib/rubocop/cop/rspec/described_class_module_wrapping.rb', line 27

def on_module(node)
  find_rspec_blocks(node) do
    add_offense(node)
  end
end