module TestBench::Fixture::Controls::Error::Backtrace

Public Class Methods

depth() click to toggle source
# File lib/test_bench/fixture/controls/error/backtrace.rb, line 24
def self.depth
  3
end
example(depth: nil) click to toggle source
# File lib/test_bench/fixture/controls/error/backtrace.rb, line 6
def self.example(depth: nil)
  depth ||= self.depth

  controls = [
    CallerLocation,
    CallerLocation::Alternate,
    CallerLocation::Alternate
  ].cycle.first(depth)

  controls.map.with_index do |control, index|
    line_number = index + 1

    caller_location = control.example(line_number: line_number)

    caller_location.to_s
  end
end