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

Instance Method Summary collapse

Methods inherited from BacktraceTweaker

#tweak_instance_exec_line

Instance Method Details

#tweak_backtrace(error, spec_name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/spec/runner/backtrace_tweaker.rb', line 23

def tweak_backtrace(error, spec_name)
  return if error.backtrace.nil?
  error.backtrace.collect! do |line|
    line = tweak_instance_exec_line line, spec_name
    line = nil if line =~ /\/lib\/spec\/api\//
    line = nil if line =~ /\/lib\/spec\/runner\//
    line = nil if line =~ /bin\/spec:/
    # TextMate's Ruby plugin
    line = nil if line =~ /Ruby\.tmbundle\/Support\/tmruby.rb:/
    # RSpec on Rails
    line = nil if line =~ /gems\/rspec_generator/
    line
  end
  error.backtrace.compact!
end