Class: Transpec::Syntax::ShouldReceive
Class Method Summary
collapse
Instance Method Summary
collapse
#wrap_subject_in_expect!
#arg_node, #arg_nodes, #arg_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
#allow_no_message?, #remove_allowance_for_no_message!
#any_instance?, #class_node_of_any_instance
Class Method Details
.target_method_names ⇒ Object
75
76
77
|
# File 'lib/transpec/syntax/should_receive.rb', line 75
def self.target_method_names
[:should_receive, :should_not_receive]
end
|
.target_receiver_node?(node) ⇒ Boolean
71
72
73
|
# File 'lib/transpec/syntax/should_receive.rb', line 71
def self.target_receiver_node?(node)
!node.nil?
end
|
Instance Method Details
#allowize_useless_expectation!(negative_form = 'not_to') ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/transpec/syntax/should_receive.rb', line 24
def allowize_useless_expectation!(negative_form = 'not_to')
return unless useless_expectation?
convert_to_syntax!('allow', negative_form)
remove_allowance_for_no_message!
register_record(:allow, negative_form)
end
|
#expectize!(negative_form = 'not_to') ⇒ Object
19
20
21
22
|
# File 'lib/transpec/syntax/should_receive.rb', line 19
def expectize!(negative_form = 'not_to')
convert_to_syntax!('expect', negative_form)
register_record(:expect, negative_form)
end
|
#positive? ⇒ Boolean
15
16
17
|
# File 'lib/transpec/syntax/should_receive.rb', line 15
def positive?
method_name == :should_receive
end
|
#stubize_useless_expectation! ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/transpec/syntax/should_receive.rb', line 33
def stubize_useless_expectation!
return unless useless_expectation?
replace(selector_range, 'stub')
remove_allowance_for_no_message!
register_record(:stub)
end
|