Method: RSpec::Core::Formatters::BaseFormatter#format_backtrace
- Defined in:
- lib/rspec/core/formatters/base_formatter.rb
#format_backtrace(backtrace, example) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/rspec/core/formatters/base_formatter.rb', line 103 def format_backtrace(backtrace, example) return "" unless backtrace return backtrace if example.[:full_backtrace] == true if at_exit_index = backtrace.index(RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE) backtrace = backtrace[0, at_exit_index] end cleansed = backtrace.map { |line| backtrace_line(line) }.compact cleansed.empty? ? backtrace : cleansed end |