Class: Transpec::Syntax::Expect

Inherits:
Transpec::Syntax show all
Includes:
Mixin::HaveMatcher, Mixin::Send
Defined in:
lib/transpec/syntax/expect.rb

Instance Attribute Summary

Attributes inherited from Transpec::Syntax

#ancestor_nodes, #node, #report, #runtime_data, #source_rewriter

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixin::Send

#arg_node, #arg_nodes, #arg_range, included, #method_name, #parentheses_range, #range_after_arg, #range_in_between_receiver_and_selector, #range_in_between_selector_and_arg, #receiver_node, #receiver_range, #selector_range

Methods included from Mixin::HaveMatcher

#have_matcher

Methods inherited from Transpec::Syntax

all_syntaxes, #expression_range, inherited, #initialize, #parent_node, register_request_for_dynamic_analysis, snake_case_name, standalone?, standalone_syntaxes, #static_context_inspector, target_node?

Constructor Details

This class inherits a constructor from Transpec::Syntax

Class Method Details

.target_method?(receiver_node, method_name) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/transpec/syntax/expect.rb', line 12

def self.target_method?(receiver_node, method_name)
  receiver_node.nil? && method_name == :expect
end

Instance Method Details

#current_syntax_typeObject



20
21
22
# File 'lib/transpec/syntax/expect.rb', line 20

def current_syntax_type
  :expect
end

#matcher_nodeObject



24
25
26
# File 'lib/transpec/syntax/expect.rb', line 24

def matcher_node
  parent_node.children[2]
end

#register_request_for_dynamic_analysis(rewriter) ⇒ Object



16
17
18
# File 'lib/transpec/syntax/expect.rb', line 16

def register_request_for_dynamic_analysis(rewriter)
  have_matcher.register_request_for_dynamic_analysis(rewriter) if have_matcher
end

#subject_rangeObject



30
31
32
# File 'lib/transpec/syntax/expect.rb', line 30

def subject_range
  subject_node.loc.expression
end