lib/rubocop/cop/rspec/describe_method.rb in rubocop-rspec-1.12.0 vs lib/rubocop/cop/rspec/describe_method.rb in rubocop-rspec-1.13.0

- old
+ new

@@ -18,18 +18,19 @@ # end class DescribeMethod < Cop include 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 = /^[\#\.].+/ + MSG = 'The second argument to describe should be the method '\ + "being tested. '#instance' or '.class'.".freeze + METHOD_STRING_MATCHER = /\A[\#\.].+/ + def on_top_level_describe(_node, (_, second_arg)) - return unless second_arg && second_arg.type.equal?(:str) + return unless second_arg && second_arg.str_type? return if METHOD_STRING_MATCHER =~ one(second_arg.children) - add_offense(second_arg, :expression, MESSAGE) + add_offense(second_arg, :expression) end end end end end