module FTest::BacktraceFilter

Public Instance Methods

call(trace) click to toggle source
# File lib/ftest/backtrace_filter.rb, line 5
def call trace
  return trace unless Config.trim_backtraces

  entry_point = trace.last
  ftest_root = File.expand_path "../..", __FILE__

  first_pass = trace.drop_while do |location|
    full_path = File.expand_path location.to_s
    full_path.start_with? ftest_root
  end

  second_pass = first_pass.take_while do |location|
    full_path = File.expand_path location.to_s
    not full_path.start_with? ftest_root
  end

  second_pass << entry_point unless second_pass.last == entry_point
  second_pass
end