Class: RuboCop::Cop::RSpec::DescribeClass
- Includes:
- RSpec::TopLevelDescribe
- Defined in:
- lib/rubocop/cop/rspec/describe_class.rb
Overview
Check that the first argument to the top level describe is a constant.
Constant Summary collapse
- MSG =
'The first argument to describe should be '\ 'the class or module being tested.'.freeze
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
Instance Method Summary collapse
Methods included from RSpec::TopLevelDescribe
Methods inherited from Cop
Instance Method Details
#on_top_level_describe(node, args) ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rubocop/cop/rspec/describe_class.rb', line 46 def on_top_level_describe(node, args) return if shared_group?(root_node) return if valid_describe?(node) (node) do |pairs| return if pairs.any?(&method(:rails_metadata?)) end add_offense(args.first, location: :expression) end |