Class: RuboCop::Cop::RSpec::MultipleDescribes
- Includes:
- RSpec::TopLevelDescribe
- Defined in:
- lib/rubocop/cop/rspec/multiple_describes.rb
Overview
Checks for multiple top level describes.
Multiple descriptions for the same class or module should either be nested or separated into different test files.
Constant Summary collapse
- MSG =
'Do not use multiple top level describes - '\ 'try to nest 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 included from RSpec::TopLevelDescribe
Methods inherited from Cop
Instance Method Details
#on_top_level_describe(node, _args) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/rubocop/cop/rspec/multiple_describes.rb', line 31 def on_top_level_describe(node, _args) return if single_top_level_describe? return unless top_level_nodes.first.equal?(node) add_offense(node, location: :expression) end |