lib/rubocop/cop/rspec/excessive_docstring_spacing.rb in rubocop-rspec-2.5.0 vs lib/rubocop/cop/rspec/excessive_docstring_spacing.rb in rubocop-rspec-2.6.0

- old
+ new

@@ -35,10 +35,12 @@ } ...) PATTERN def on_send(node) example_description(node) do |description_node, message| + return if description_node.heredoc? + text = text(message) return unless excessive_whitespace?(text) add_whitespace_offense(description_node, text) @@ -47,10 +49,12 @@ private # @param text [String] def excessive_whitespace?(text) - text.start_with?(' ') || text.include?(' ') || text.end_with?(' ') + return true if text.start_with?(' ') || text.end_with?(' ') + + text.match?(/[^\n ] +[^ ]/) end # @param text [String] def strip_excessive_whitespace(text) text.strip.gsub(/ +/, ' ')