lib/rubocop/cop/rspec/receive_messages.rb in rubocop-rspec-2.23.1 vs lib/rubocop/cop/rspec/receive_messages.rb in rubocop-rspec-2.23.2

- old
+ new

@@ -35,11 +35,11 @@ MSG = 'Use `receive_messages` instead of multiple stubs on lines ' \ '%<loc>s.' # @!method allow_receive_message?(node) def_node_matcher :allow_receive_message?, <<~PATTERN - (send (send nil? :allow ...) :to (send (send nil? :receive (sym _)) :and_return !#heredoc?)) + (send (send nil? :allow ...) :to (send (send nil? :receive (sym _)) :and_return !#heredoc_or_splat?)) PATTERN # @!method allow_argument(node) def_node_matcher :allow_argument, <<~PATTERN (send (send nil? :allow $_ ...) ...) @@ -145,15 +145,16 @@ def item_range_by_whole_lines(item) range_by_whole_lines(item.source_range, include_final_newline: true) end - def heredoc?(node) - (node.str_type? || node.dstr_type?) && node.heredoc? + def heredoc_or_splat?(node) + (node.str_type? || node.dstr_type?) && node.heredoc? || + node.splat_type? end def requires_quotes?(value) - value.match?(/^:".*?"|=$/) + value.match?(/^:".*?"|=$|^\W+$/) end end end end end