Class: RuboCop::Cop::Salsify::RspecDocString
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Salsify::RspecDocString
- Includes:
- ConfigurableEnforcedStyle
- Defined in:
- lib/rubocop/cop/salsify/rspec_doc_string.rb
Overview
Check that doc strings for example groups and examples use either single-quoted or double-quoted strings based on the enforced style.
Constant Summary collapse
- SINGLE_QUOTE_MSG =
'Example Group/Example doc strings must be single-quoted.'.freeze
- DOUBLE_QUOTE_MSG =
'Example Group/Example doc strings must be double-quoted.'.freeze
- SHARED_EXAMPLES =
RuboCop::RSpec::Language::SelectorSet.new( [:include_examples, :it_behaves_like, :it_should_behave_like, :include_context] ).freeze
- DOCUMENTED_METHODS =
(RuboCop::RSpec::Language::ExampleGroups::ALL + RuboCop::RSpec::Language::Examples::ALL + RuboCop::RSpec::Language::SharedGroups::ALL + SHARED_EXAMPLES).freeze
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
45 46 47 |
# File 'lib/rubocop/cop/salsify/rspec_doc_string.rb', line 45 def autocorrect(node) StringLiteralCorrector.correct(node, style) end |
#on_send(node) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/rubocop/cop/salsify/rspec_doc_string.rb', line 37 def on_send(node) _receiver, method_name, *args = *node return unless DOCUMENTED_METHODS.include?(method_name) && !args.empty? && args.first.str_type? check_quotes(args.first) end |