lib/rubocop/cop/rspec/describe_method.rb in rubocop-rspec-1.6.0 vs lib/rubocop/cop/rspec/describe_method.rb in rubocop-rspec-1.7.0
- old
+ new
@@ -1,12 +1,11 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
- # Checks that the second argument to the top level describe is the tested
- # method name.
+ # Checks that the second argument to `describe` specifies a method.
#
# @example
# # bad
# describe MyClass, 'do something' do
# end
@@ -16,10 +15,12 @@
# end
#
# describe MyClass, '.my_class_method' do
# end
class DescribeMethod < Cop
- include RuboCop::RSpec::TopLevelDescribe, RuboCop::RSpec::Util
+ include RuboCop::RSpec::SpecOnly,
+ RuboCop::RSpec::TopLevelDescribe,
+ RuboCop::RSpec::Util
MESSAGE = 'The second argument to describe should be the method ' \
"being tested. '#instance' or '.class'".freeze
METHOD_STRING_MATCHER = /^[\#\.].+/