lib/rubocop/cop/rspec/context_wording.rb in rubocop-rspec-1.42.0 vs lib/rubocop/cop/rspec/context_wording.rb in rubocop-rspec-1.43.0

- old
+ new

@@ -32,15 +32,15 @@ # # # good # context 'when the display name is not present' do # # ... # end - class ContextWording < Cop + class ContextWording < Base MSG = 'Start context description with %<prefixes>s.' def_node_matcher :context_wording, <<-PATTERN - (block (send #{RSPEC} { :context :shared_context } $(str #bad_prefix?) ...) ...) + (block (send #rspec? { :context :shared_context } $(str #bad_prefix?) ...) ...) PATTERN def on_block(node) context_wording(node) do |context| add_offense(context, @@ -49,10 +49,10 @@ end private def bad_prefix?(description) - !prefixes.include?(description.split.first) + !prefixes.include?(description.split(/\b/).first) end def joined_prefixes quoted = prefixes.map { |prefix| "'#{prefix}'" } return quoted.first if quoted.size == 1