Class: Spec::Runner::QuietBacktraceTweaker

Inherits:
BacktraceTweaker show all
Defined in:
lib/spec/runner/backtrace_tweaker.rb

Overview

Tweaks raised Exceptions to mask noisy (unneeded) parts of the backtrace

Constant Summary collapse

IGNORE_PATTERNS =
spec_files + [
  /\/lib\/ruby\//,
  /bin\/spec:/,
  /bin\/rcov:/,
  /lib\/rspec_on_rails/,
  /vendor\/rails/,
  # TextMate's Ruby and RSpec plugins
  /Ruby\.tmbundle\/Support\/tmruby.rb:/,
  /RSpec\.tmbundle\/Support\/lib/,
  /temp_textmate\./
]

Instance Method Summary collapse

Methods inherited from BacktraceTweaker

#clean_up_double_slashes

Instance Method Details

#tweak_backtrace(error, spec_name) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/spec/runner/backtrace_tweaker.rb', line 39

def tweak_backtrace(error, spec_name)
  return if error.backtrace.nil?
  error.backtrace.collect! do |line|
    clean_up_double_slashes(line)
    IGNORE_PATTERNS.each do |ignore|
      if line =~ ignore
        line = nil
        break
      end
    end
    line
  end
  error.backtrace.compact!
end