class Transpec::Syntax::BeClose

Public Instance Methods

convert_to_be_within!() click to toggle source
# File lib/transpec/syntax/be_close.rb, line 15
def convert_to_be_within!
  _receiver_node, _method_name, expected_node, delta_node = *node

  be_within_source = 'be_within('
  be_within_source << delta_node.loc.expression.source
  be_within_source << ').of('
  be_within_source << expected_node.loc.expression.source
  be_within_source << ')'

  replace(expression_range, be_within_source)

  add_record
end
dynamic_analysis_target?() click to toggle source
# File lib/transpec/syntax/be_close.rb, line 11
def dynamic_analysis_target?
  super && receiver_node.nil? && method_name == :be_close
end

Private Instance Methods

add_record() click to toggle source
Calls superclass method Transpec::Syntax#add_record
# File lib/transpec/syntax/be_close.rb, line 31
def add_record
  super('be_close(expected, delta)', 'be_within(delta).of(expected)')
end