module Transpec::Syntax::Mixin::Send::TargetDetection

Public Instance Methods

conversion_target?() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 16
def conversion_target?
  return false unless dynamic_analysis_target?
  return true unless runtime_data.run?(send_analysis_target_node)
  defined_by_rspec?
end
dynamic_analysis_target?() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 12
def dynamic_analysis_target?
  node && node.send_type?
end

Private Instance Methods

defined_by_rspec?() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 24
def defined_by_rspec?
  defined_in_rspec_source? && !example_method_defined_by_user?
end
defined_in_rspec_source?() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 28
def defined_in_rspec_source?
  source_location = runtime_data[send_analysis_target_node, source_location_key]
  return true unless source_location
  source_path = source_location.first
  return false unless source_path
  source_path.match(%r{/rspec\-[^/]+/lib/rspec/})
end
example_method_defined_by_user?() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 36
def example_method_defined_by_user?
  runtime_data[send_analysis_target_node, example_method_defined_by_user_key]
end
example_method_defined_by_user_key() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 48
def example_method_defined_by_user_key
  "#{method_name}_example_method_defined_by_user?".to_sym
end
send_analysis_target_node() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 40
def send_analysis_target_node
  receiver_node || node
end
source_location_key() click to toggle source
# File lib/transpec/syntax/mixin/send.rb, line 44
def source_location_key
  "#{method_name}_source_location".to_sym
end