lib/rubocop/cop/rspec/describe_class.rb in rubocop-rspec-1.8.0 vs lib/rubocop/cop/rspec/describe_class.rb in rubocop-rspec-1.9.0

- old
+ new

@@ -15,11 +15,11 @@ # end # # describe "A feature example", type: :feature do # end class DescribeClass < Cop - include RuboCop::RSpec::SpecOnly, RuboCop::RSpec::TopLevelDescribe + include RuboCop::RSpec::TopLevelDescribe MSG = 'The first argument to describe should be '\ 'the class or module being tested.'.freeze def_node_matcher :valid_describe?, <<-PATTERN @@ -37,10 +37,15 @@ (pair (sym :type) (sym {:request :feature :routing :view})) PATTERN + def_node_matcher :shared_group?, <<-PATTERN + (block (send {(const nil :RSpec) nil} #{SharedGroups::ALL.node_pattern_union} ...) ...) + PATTERN + def on_top_level_describe(node, args) + return if shared_group?(root_node) return if valid_describe?(node) describe_with_metadata(node) do |pairs| return if pairs.any?(&method(:rails_metadata?)) end