Class: Transpec::Syntax::Its
- Inherits:
-
Transpec::Syntax
- Object
- Transpec::Syntax
- Transpec::Syntax::Its
- Includes:
- Mixin::Examplish, Mixin::Send, Util
- Defined in:
- lib/transpec/syntax/its.rb
Defined Under Namespace
Classes: Attribute, AttributeExpression, RecordBuilder
Constant Summary
Constants included from Util
Util::LITERAL_TYPES, Util::WHITESPACES
Instance Attribute Summary
Attributes inherited from Transpec::Syntax
#node, #project, #report, #runtime_data, #source_rewriter
Instance Method Summary collapse
- #attribute_expression ⇒ Object
- #attributes ⇒ Object
- #block_node ⇒ Object
- #conversion_target? ⇒ Boolean
- #convert_to_describe_subject_it! ⇒ Object
- #description? ⇒ Boolean
- #dynamic_analysis_target? ⇒ Boolean
- #insert_blank_line_above! ⇒ Object
Methods included from Mixin::Examplish
Methods included from Mixin::BlockOwner
#block_beginning_line, #block_body_line, #block_body_node, #block_body_range, #block_end_line, #block_has_body?, #convert_singleline_block_to_multiline!, #range_between_block_begin_and_body, #range_between_block_body_and_end
Methods included from Mixin::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 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
Methods inherited from Transpec::Syntax
#dependent_syntaxes, #expression_range, #initialize, #inspect, #parent_node, #rspec_version, snake_case_name, standalone?, #static_context_inspector
Methods included from Collection
#all_syntaxes, #inherited, #mixins, #require_all, #standalone_syntaxes
Methods included from DynamicAnalysis
#register_dynamic_analysis_request
Constructor Details
This class inherits a constructor from Transpec::Syntax
Instance Method Details
#attribute_expression ⇒ Object
41 42 43 |
# File 'lib/transpec/syntax/its.rb', line 41 def attribute_expression @attribute_expression ||= AttributeExpression.new(attribute_node) end |
#attributes ⇒ Object
45 46 47 |
# File 'lib/transpec/syntax/its.rb', line 45 def attributes attribute_expression.attributes end |
#block_node ⇒ Object
51 52 53 |
# File 'lib/transpec/syntax/its.rb', line 51 def block_node node.parent end |
#conversion_target? ⇒ Boolean
23 24 25 |
# File 'lib/transpec/syntax/its.rb', line 23 def conversion_target? super && !runtime_data[node, :project_requires_its?] end |
#convert_to_describe_subject_it! ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/transpec/syntax/its.rb', line 27 def convert_to_describe_subject_it! insert_before(beginning_of_line_range(block_node), front_code) replace(range_from_its_to_front_of_block, additional_indentation_for_it + 'it ') insert_after(block_node.loc.expression, rear_code) increment_block_base_indentation! add_record end |
#description? ⇒ Boolean
55 56 57 |
# File 'lib/transpec/syntax/its.rb', line 55 def description? false end |
#dynamic_analysis_target? ⇒ Boolean
19 20 21 |
# File 'lib/transpec/syntax/its.rb', line 19 def dynamic_analysis_target? super && receiver_node.nil? && method_name == :its end |
#insert_blank_line_above! ⇒ Object
37 38 39 |
# File 'lib/transpec/syntax/its.rb', line 37 def insert_blank_line_above! insert_after(beginning_of_line_range(node), "\n") end |