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.
This cop is disabled by default.
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( %i(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
#on_send(node) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/rubocop/cop/salsify/rspec_doc_string.rb', line 41 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 |