Class: RuboCop::RSpec::Example

Inherits:
Concept
  • Object
show all
Defined in:
lib/rubocop/rspec/example.rb

Overview

Wrapper for RSpec examples

Instance Method Summary collapse

Methods inherited from Concept

#eql?, #hash, #initialize, #to_node

Methods included from Language

#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?

Constructor Details

This class inherits a constructor from RuboCop::RSpec::Concept

Instance Method Details

#definitionObject



28
29
30
31
32
33
34
# File 'lib/rubocop/rspec/example.rb', line 28

def definition
  if node.send_type?
    node
  else
    node.send_node
  end
end

#doc_stringObject



16
17
18
# File 'lib/rubocop/rspec/example.rb', line 16

def doc_string
  extract_doc_string(definition)
end

#extract_doc_string(node) ⇒ Object



8
# File 'lib/rubocop/rspec/example.rb', line 8

def_node_matcher :extract_doc_string,     '(send _ _ $_ ...)'

#extract_implementation(node) ⇒ Object



14
# File 'lib/rubocop/rspec/example.rb', line 14

def_node_matcher :extract_implementation, '(block send args $_)'

#extract_metadata(node) ⇒ Object



11
# File 'lib/rubocop/rspec/example.rb', line 11

def_node_matcher :extract_metadata,       '(send _ _ _ $...)'

#implementationObject



24
25
26
# File 'lib/rubocop/rspec/example.rb', line 24

def implementation
  extract_implementation(node)
end

#metadataObject



20
21
22
# File 'lib/rubocop/rspec/example.rb', line 20

def 
  (definition)
end