4 def clean_up_double_slashes(line)
9 class NoisyBacktraceTweaker < BacktraceTweaker
10 def tweak_backtrace(error)
11 return if error.backtrace.nil?
12 error.backtrace.each do |line|
13 clean_up_double_slashes(line)
18 # Tweaks raised Exceptions to mask noisy (unneeded) parts of the backtrace
19 class QuietBacktraceTweaker < BacktraceTweaker
20 unless defined?(IGNORE_PATTERNS)
21 root_dir = File.expand_path(File.join(__FILE__, '..', '..', '..', '..'))
22 spec_files = Dir["#{root_dir}/lib/*"].map do |path|
23 subpath = path[root_dir.length..-1]
26 IGNORE_PATTERNS = spec_files + [
30 /lib\/rspec_on_rails/,
32 # TextMate's Ruby and RSpec plugins
33 /Ruby\.tmbundle\/Support\/tmruby.rb:/,
34 /RSpec\.tmbundle\/Support\/lib/,
36 /mock_frameworks\/rspec/,
41 def tweak_backtrace(error)
42 return if error.backtrace.nil?
43 error.backtrace.collect! do |line|
44 clean_up_double_slashes(line)
45 IGNORE_PATTERNS.each do |ignore|
53 error.backtrace.compact!