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 + [
  /\/rspec-[^\/]*\/lib\/spec\//,
  /\/spork-[^\/]*\/lib\/spork\//,
  /\/lib\/ruby\//,
  /bin\/spec:/,
  /bin\/spork:/,
  /bin\/rcov:/,
  /lib\/rspec-rails/,
  /vendor\/rails/,
  # TextMate's Ruby and RSpec plugins
  /Ruby\.tmbundle\/Support\/tmruby.rb:/,
  /RSpec\.tmbundle\/Support\/lib/,
  /temp_textmate\./,
  /mock_frameworks\/rspec/,
  /spec_server/
]

Instance Method Summary collapse

Methods inherited from BacktraceTweaker

#clean_up_double_slashes, #tweak_backtrace

Constructor Details

#initialize(*patterns) ⇒ QuietBacktraceTweaker

Returns a new instance of QuietBacktraceTweaker.


64
65
66
67
# File 'lib/spec/runner/backtrace_tweaker.rb', line 64

def initialize(*patterns)
  super
  ignore_patterns(*patterns)
end

Instance Method Details

#ignore_patterns(*patterns) ⇒ Object


69
70
71
# File 'lib/spec/runner/backtrace_tweaker.rb', line 69

def ignore_patterns(*patterns)
  @ignore_patterns += patterns.flatten.map { |pattern| Regexp.new(pattern) }
end

#ignored_patternsObject


73
74
75
# File 'lib/spec/runner/backtrace_tweaker.rb', line 73

def ignored_patterns
  IGNORE_PATTERNS + @ignore_patterns
end