class XSpec::Notifier::FailuresAtEnd
Outputs error messages and backtraces after the entire run is complete.
Attributes
errors[RW]
out[RW]
Public Class Methods
new(out = $stdout)
click to toggle source
# File lib/xspec/notifiers.rb, line 172 def initialize(out = $stdout) @errors = [] @out = out end
Public Instance Methods
evaluate_finish(result)
click to toggle source
# File lib/xspec/notifiers.rb, line 177 def evaluate_finish(result) self.errors += result.errors end
run_finish()
click to toggle source
# File lib/xspec/notifiers.rb, line 181 def run_finish return true if errors.empty? out.puts errors.each do |error| out.puts "%s - %s\n%s\n\n" % [ short_id_for(error.unit_of_work), error.unit_of_work.full_name, error.message.lines.map {|x| " #{x}"}.join("") ] clean_backtrace(error.caller).each do |line| out.puts " %s" % line end out.puts end false end
Private Instance Methods
clean_backtrace(backtrace)
click to toggle source
A standard backtrace contains many entries for XSpec
itself which are not useful for debugging your tests, so they are stripped out.
# File lib/xspec/notifiers.rb, line 204 def clean_backtrace(backtrace) lib_dir = File.dirname(File.expand_path('..', __FILE__)) backtrace.reject {|x| File.dirname(x).start_with?(lib_dir) } end