Class: Spec::Runner::BacktraceTweaker
- Inherits:
-
Object
- Object
- Spec::Runner::BacktraceTweaker
show all
- Defined in:
- lib/vendor/plugins/rspec/lib/spec/runner/backtrace_tweaker.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BacktraceTweaker.
4
5
6
|
# File 'lib/vendor/plugins/rspec/lib/spec/runner/backtrace_tweaker.rb', line 4
def initialize(*patterns)
@ignore_patterns = []
end
|
Instance Method Details
#clean_up_double_slashes(line) ⇒ Object
8
9
10
|
# File 'lib/vendor/plugins/rspec/lib/spec/runner/backtrace_tweaker.rb', line 8
def clean_up_double_slashes(line)
line.gsub!('//','/')
end
|
#ignore_patterns(*patterns) ⇒ Object
12
13
14
|
# File 'lib/vendor/plugins/rspec/lib/spec/runner/backtrace_tweaker.rb', line 12
def ignore_patterns(*patterns)
end
|
#ignored_patterns ⇒ Object
16
17
18
|
# File 'lib/vendor/plugins/rspec/lib/spec/runner/backtrace_tweaker.rb', line 16
def ignored_patterns
[]
end
|
#tweak_backtrace(error) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/vendor/plugins/rspec/lib/spec/runner/backtrace_tweaker.rb', line 20
def tweak_backtrace(error)
return if error.backtrace.nil?
tweaked = error.backtrace.collect do |message|
clean_up_double_slashes(message)
kept_lines = message.split("\n").select do |line|
ignored_patterns.each do |ignore|
break if line =~ ignore
end
end
kept_lines.empty?? nil : kept_lines.join("\n")
end
error.set_backtrace(tweaked.select {|line| line})
end
|