Module: Transpec::Syntax::Mixin::ExpectBase
- Extended by:
- ActiveSupport::Concern
- Includes:
- MatcherOwner, 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
#conversion_target?, #dynamic_analysis_target?
Instance Method Details
#current_syntax_type ⇒ Object
20
21
22
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 20
def current_syntax_type
:expect
end
|
#matcher_node ⇒ Object
45
46
47
48
49
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 45
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
24
25
26
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 24
def method_name_for_instance
fail NotImplementedError
end
|
#positive? ⇒ Boolean
28
29
30
31
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 28
def positive?
to_method_name = to_node.children[1]
to_method_name == :to
end
|
#subject_node ⇒ Object
33
34
35
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 33
def subject_node
arg_node || parent_node
end
|
#subject_range ⇒ Object
55
56
57
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 55
def subject_range
subject_node.loc.expression
end
|
#to_node ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/transpec/syntax/mixin/expect_base.rb', line 37
def to_node
if parent_node.block_type? && parent_node.children.first.equal?(node)
parent_node.parent_node
else
parent_node
end
end
|