Class: Transpec::Syntax::RSpecConfigure::Framework

Inherits:
Object
  • Object
show all
Includes:
ConfigModification, SyntaxConfig
Defined in:
lib/transpec/syntax/rspec_configure/framework.rb

Direct Known Subclasses

Expectations, Mocks

Defined Under Namespace

Modules: SyntaxConfig

Constant Summary

Constants included from Util

Util::LITERAL_TYPES, Util::WHITESPACES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SyntaxConfig

#syntaxes, #syntaxes=

Methods included from ConfigModification::ConfigAddition

#add_config!, #empty_block_body?

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

Constructor Details

#initialize(rspec_configure, source_rewriter) ⇒ Framework

Returns a new instance of Framework.



13
14
15
16
# File 'lib/transpec/syntax/rspec_configure/framework.rb', line 13

def initialize(rspec_configure, source_rewriter)
  @rspec_configure = rspec_configure
  @source_rewriter = source_rewriter
end

Instance Attribute Details

#rspec_configureObject (readonly)

Returns the value of attribute rspec_configure.



11
12
13
# File 'lib/transpec/syntax/rspec_configure/framework.rb', line 11

def rspec_configure
  @rspec_configure
end

#source_rewriterObject (readonly)

Returns the value of attribute source_rewriter.



11
12
13
# File 'lib/transpec/syntax/rspec_configure/framework.rb', line 11

def source_rewriter
  @source_rewriter
end

Instance Method Details

#block_nodeObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/transpec/syntax/rspec_configure/framework.rb', line 18

def block_node
  return @block_node if instance_variable_defined?(:@block_node)

  @block_node = rspec_configure.block_node.each_descendent_node.find do |node|
    next unless node.block_type?
    send_node = node.children.first
    receiver_node, method_name, *_ = *send_node
    next unless receiver_node == s(:lvar, rspec_configure.block_arg_name)
    method_name == block_method_name
    # TODO: Check expectation framework.
  end
end