Class: Transpec::Syntax::RSpecConfigure

Inherits:
Transpec::Syntax show all
Includes:
Util
Defined in:
lib/transpec/syntax/rspec_configure.rb,
lib/transpec/syntax/rspec_configure/mocks.rb,
lib/transpec/syntax/rspec_configure/framework.rb,
lib/transpec/syntax/rspec_configure/expectations.rb

Defined Under Namespace

Classes: Expectations, Framework, Mocks

Constant Summary

Constants included from Util

Util::LITERAL_TYPES, Util::WHITESPACES

Instance Attribute Summary

Attributes inherited from Transpec::Syntax

#node, #report, #runtime_data, #source_rewriter

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

beginning_of_line_range, block_node_taken_by_method, const_name, contain_here_document?, each_backward_chained_node, each_forward_chained_node, each_line_range, end_of_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?, node_id, proc_literal?, range_from_arg

Methods inherited from Transpec::Syntax

conversion_target_node?, #expression_range, #initialize, #parent_node, snake_case_name, standalone?, #static_context_inspector

Methods included from Collection

#all_syntaxes, #inherited, #require_all, #standalone_syntaxes

Methods included from DynamicAnalysis

#register_request_for_dynamic_analysis

Constructor Details

This class inherits a constructor from Transpec::Syntax

Class Method Details

.target_node?(node, runtime_data = nil) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
# File 'lib/transpec/syntax/rspec_configure.rb', line 14

def self.target_node?(node, runtime_data = nil)
  return false unless node && node.block_type?
  send_node = node.children.first
  receiver_node, method_name, *_ = *send_node
  Util.const_name(receiver_node) == 'RSpec' && method_name == :configure
end

Instance Method Details

#block_arg_nameObject



29
30
31
# File 'lib/transpec/syntax/rspec_configure.rb', line 29

def block_arg_name
  first_block_arg_name(node)
end

#expectationsObject



21
22
23
# File 'lib/transpec/syntax/rspec_configure.rb', line 21

def expectations
  @expectations ||= Expectations.new(self, source_rewriter)
end

#mocksObject



25
26
27
# File 'lib/transpec/syntax/rspec_configure.rb', line 25

def mocks
  @mocks ||= Mocks.new(self, source_rewriter)
end