Class: RuboCop::Cop::RSpec::MultipleDescribes
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::RSpec::MultipleDescribes
- Includes:
- RSpec::TopLevelDescribe
- Defined in:
- lib/rubocop/cop/rspec/multiple_describes.rb
Overview
Checks for multiple top level describes. They should be nested if it is for the same class or module or seperated into different files.
Constant Summary collapse
- MSG =
'Do not use multiple top level describes - ' \ 'try to nest them.'.freeze
Instance Method Summary collapse
Methods included from RSpec::TopLevelDescribe
Instance Method Details
#on_top_level_describe(node, _args) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/rubocop/cop/rspec/multiple_describes.rb', line 30 def on_top_level_describe(node, _args) return if single_top_level_describe? return unless top_level_nodes.first == node add_offense(node, :expression, MSG) end |