Module: Transpec::Syntax::Mixin::ExpectBase
- Extended by:
- ActiveSupport::Concern
- Includes:
- Send
- Included in:
- Allow, Expect
- Defined in:
- lib/transpec/syntax/mixin/expect_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
Instance Method Details
#block_node ⇒ Object
45
46
47
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 45
def block_node
Util.block_node_taken_by_method(to_node)
end
|
#current_syntax_type ⇒ Object
26
27
28
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 26
def current_syntax_type
:expect
end
|
#matcher_node ⇒ Object
39
40
41
42
43
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 39
def matcher_node
to_arg_node = to_node.children[2]
Util.each_forward_chained_node(to_arg_node, :include_origin)
.select(&:send_type?).to_a.last
end
|
#method_name_for_instance ⇒ Object
30
31
32
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 30
def method_name_for_instance
fail NotImplementedError
end
|
#positive? ⇒ Boolean
34
35
36
37
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 34
def positive?
to_method_name = to_node.children[1]
to_method_name == :to
end
|
#receive_matcher ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 53
def receive_matcher
return @receive_matcher if instance_variable_defined?(:@receive_matcher)
@receive_matcher ||= if Receive.conversion_target_node?(matcher_node, @runtime_data)
create_receive_matcher
else
nil
end
end
|
#subject_range ⇒ Object
49
50
51
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 49
def subject_range
subject_node.loc.expression
end
|