Class: RuboCop::Cop::RSpec::DescribeClass
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::RSpec::DescribeClass
- Includes:
- RSpec::SpecOnly, 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 included from RSpec::SpecOnly
RSpec::SpecOnly::DEFAULT_CONFIGURATION
Instance Method Summary collapse
Methods included from RSpec::SpecOnly
Methods included from RSpec::TopLevelDescribe
Instance Method Details
#on_top_level_describe(node, args) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/rubocop/cop/rspec/describe_class.rb', line 42 def on_top_level_describe(node, args) return if valid_describe?(node) (node) do |pairs| return if pairs.any?(&method(:rails_metadata?)) end add_offense(args.first, :expression) end |