Class: RuboCop::Cop::Salsify::RspecStringLiterals

Inherits:
RSpec::Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
ConfigurableEnforcedStyle, StringLiteralsHelp
Defined in:
lib/rubocop/cop/salsify/rspec_string_literals.rb

Overview

This cop checks if quotes match the configured preference. It is intended to be use specifically for specs and in combination with Salsify/RspecDocString.

Used together with Salsify/RspecDocString it allows one quote style to be used for doc strings (`describe “foobar”`) and another style to be used for all other strings in specs.

Constant Summary collapse

DOCUMENTED_METHODS =
RuboCop::Cop::Salsify::RspecDocString::DOCUMENTED_METHODS
SINGLE_QUOTE_MSG =
'Prefer single-quoted strings unless you need ' \
'interpolation or special symbols.'
DOUBLE_QUOTE_MSG =
'Prefer double-quoted strings unless you need ' \
'single quotes to avoid extra backslashes for escaping.'

Instance Method Summary collapse

Instance Method Details

#autocorrect(corrector, node) ⇒ Object


26
27
28
# File 'lib/rubocop/cop/salsify/rspec_string_literals.rb', line 26

def autocorrect(corrector, node)
  StringLiteralCorrector.correct(corrector, node, style)
end