Class: XSpec::Notifier::FailuresAtEnd

Inherits:
Object
  • Object
show all
Includes:
Composable
Defined in:
lib/xspec/notifiers.rb

Overview

Outputs error messages and backtraces after the entire run is complete.

Instance Method Summary collapse

Methods included from Composable

#+

Constructor Details

#initialize(out = $stdout) ⇒ FailuresAtEnd

Returns a new instance of FailuresAtEnd.



155
156
157
158
# File 'lib/xspec/notifiers.rb', line 155

def initialize(out = $stdout)
  @errors = []
  @out    = out
end

Instance Method Details

#evaluate_finish(result) ⇒ Object



164
165
166
# File 'lib/xspec/notifiers.rb', line 164

def evaluate_finish(result)
  self.errors += result.errors
end

#evaluate_start(*_) ⇒ Object



162
# File 'lib/xspec/notifiers.rb', line 162

def evaluate_start(*_); end

#run_finishObject



168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/xspec/notifiers.rb', line 168

def run_finish
  return true if errors.empty?

  out.puts
  errors.each do |error|
    out.puts "%s:\n%s\n\n" % [full_name(error.unit_of_work), error.message.lines.map {|x| "  #{x}"}.join("")]
    clean_backtrace(error.caller).each do |line|
      out.puts "  %s" % line
    end
    out.puts
  end

  false
end

#run_startObject



160
# File 'lib/xspec/notifiers.rb', line 160

def run_start; end