Class: Transpec::Syntax::Its
- Inherits:
-
Syntax
- Object
- Syntax
- Transpec::Syntax::Its
show all
- Includes:
- Mixin::Send, Util
- Defined in:
- lib/transpec/syntax/its.rb
Defined Under Namespace
Classes: Attribute, AttributeExpression
Constant Summary
Constants included
from Util
Util::LITERAL_TYPES, Util::WHITESPACES
Instance Method Summary
collapse
#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 Util
beginning_of_line_range, block_node_taken_by_method, chainable_source, const_name, contain_here_document?, each_backward_chained_node, each_forward_chained_node, each_line_range, expand_range_to_adjacent_whitespaces, find_consecutive_whitespace_position, first_block_arg_name, here_document?, in_explicit_parentheses?, indentation_of_line, line_range, literal?, proc_literal?, range_from_arg
Instance Method Details
#attribute_expression ⇒ Object
36
37
38
|
# File 'lib/transpec/syntax/its.rb', line 36
def attribute_expression
@attribute_expression ||= AttributeExpression.new(attribute_node)
end
|
#attributes ⇒ Object
40
41
42
|
# File 'lib/transpec/syntax/its.rb', line 40
def attributes
attribute_expression.attributes
end
|
#block_node ⇒ Object
46
47
48
|
# File 'lib/transpec/syntax/its.rb', line 46
def block_node
node.parent_node
end
|
#conversion_target? ⇒ Boolean
22
23
24
|
# File 'lib/transpec/syntax/its.rb', line 22
def conversion_target?
super && !runtime_data[node, :project_requires_its?]
end
|
#convert_to_describe_subject_it! ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/transpec/syntax/its.rb', line 26
def convert_to_describe_subject_it!
front, rear = build_wrapper_codes
insert_before(beginning_of_line_range(block_node), front)
replace(range_from_its_to_front_of_block, 'it ')
insert_after(block_node.loc.expression, rear)
add_record
end
|
#dynamic_analysis_target? ⇒ Boolean
18
19
20
|
# File 'lib/transpec/syntax/its.rb', line 18
def dynamic_analysis_target?
super && receiver_node.nil? && method_name == :its
end
|