class RuboCop::Cop::RSpec::SharedExamples::Checker

Constants

MSG

Attributes

node[R]

Public Class Methods

new(node) click to toggle source
# File lib/rubocop/cop/rspec/shared_examples.rb, line 50
def initialize(node)
  @node = node
end

Public Instance Methods

message() click to toggle source
# File lib/rubocop/cop/rspec/shared_examples.rb, line 54
def message
  format(MSG, prefer: preferred_style, current: symbol.inspect)
end
preferred_style() click to toggle source
# File lib/rubocop/cop/rspec/shared_examples.rb, line 58
def preferred_style
  string = symbol.to_s.tr('_', ' ')
  wrap_with_single_quotes(string)
end

Private Instance Methods

symbol() click to toggle source
# File lib/rubocop/cop/rspec/shared_examples.rb, line 65
def symbol
  node.value
end
wrap_with_single_quotes(string) click to toggle source
# File lib/rubocop/cop/rspec/shared_examples.rb, line 69
def wrap_with_single_quotes(string)
  "'#{string}'"
end