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

Inherits:
Cop
  • 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.'

Constants inherited from Cop

Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE

Constants included from RSpec::Language

RSpec::Language::ALL, RSpec::Language::RSPEC

Instance Method Summary collapse

Methods inherited from Cop

inherited, #relevant_file?

Instance Method Details

#on_module(node) ⇒ Object



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

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