Class: RuboCop::Cop::RSpec::DescribeClass
- Includes:
- TopLevelGroup
- Defined in:
- lib/rubocop/cop/rspec/describe_class.rb
Overview
Check that the first argument to the top-level describe is a constant.
It can be configured to ignore strings when certain metadata is passed.
Ignores Rails and Aruba ‘type` metadata by default.
Constant Summary collapse
- MSG =
'The first argument to describe should be ' \ 'the class or module being tested.'
Instance Method Summary collapse
Methods included from TopLevelGroup
#on_new_investigation, #top_level_groups
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language::NodePattern
Instance Method Details
#on_top_level_group(node) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/rubocop/cop/rspec/describe_class.rb', line 55 def on_top_level_group(node) return if (node.send_node) not_a_const_described(node.send_node) do |described| add_offense(described) end end |