Class: Buildr::TestFramework::TestResult::RSpecResultHandler::BacktraceTweaker

Inherits:
Object
  • Object
show all
Defined in:
lib/buildr/java/test_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBacktraceTweaker

Returns a new instance of BacktraceTweaker.



121
122
123
124
125
126
# File 'lib/buildr/java/test_result.rb', line 121

def initialize
  @ignore_patterns = ::Spec::Runner::QuietBacktraceTweaker::IGNORE_PATTERNS.dup
  # ignore jruby/jtestr backtrace
  ignore_patterns << /org\.jruby\.javasupport\.JavaMethod\./
  ignore_patterns << /jtestr.*\.jar!/i << /runner\.rb/
end

Instance Attribute Details

#ignore_patternsObject (readonly)

Returns the value of attribute ignore_patterns.



120
121
122
# File 'lib/buildr/java/test_result.rb', line 120

def ignore_patterns
  @ignore_patterns
end

Instance Method Details

#clean_up_double_slashes(line) ⇒ Object



128
129
130
# File 'lib/buildr/java/test_result.rb', line 128

def clean_up_double_slashes(line)
  line.gsub!('//','/')
end

#tweak_backtrace(error) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/buildr/java/test_result.rb', line 132

def tweak_backtrace(error)
  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