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.'- DOUBLE_QUOTE_MSG =
'Example Group/Example doc strings must be double-quoted.'- 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
47 48 49 |
# File 'lib/rubocop/cop/salsify/rspec_doc_string.rb', line 47 def autocorrect(node) StringLiteralCorrector.correct(node, style) end |
#on_send(node) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/rubocop/cop/salsify/rspec_doc_string.rb', line 39 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 |