Module: Transpec::Syntax::Mixin::ShouldBase

Extended by:
ActiveSupport::Concern
Includes:
MatcherOwner, Send
Included in:
OnelinerShould, Should
Defined in:
lib/transpec/syntax/mixin/should_base.rb

Instance Method Summary collapse

Methods included from Send

#arg_node, #arg_nodes, #arg_range, #args_range, #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 Transpec::Syntax::Mixin::Send::TargetDetection

#conversion_target?, #dynamic_analysis_target?

Methods included from MatcherOwner

#dependent_syntaxes

Instance Method Details

#current_syntax_typeObject



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

def current_syntax_type
  @current_syntax_type ||= :should
end

#matcher_nodeObject



32
33
34
35
36
37
38
39
# File 'lib/transpec/syntax/mixin/should_base.rb', line 32

def matcher_node
  if arg_node
    Util.each_forward_chained_node(arg_node, :include_origin)
      .select(&:send_type?).to_a.last
  else
    parent_node
  end
end

#positive?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/transpec/syntax/mixin/should_base.rb', line 28

def positive?
  method_name == :should
end

#should_rangeObject



41
42
43
44
45
46
47
# File 'lib/transpec/syntax/mixin/should_base.rb', line 41

def should_range
  if arg_node
    selector_range
  else
    selector_range.join(expression_range.end)
  end
end