class Defekt::Runner

Attributes

benchmark[R]
collection[R]

Public Class Methods

new(collection) click to toggle source
# File lib/defekt/runner.rb, line 7
def initialize(collection)
  @collection = collection
end

Public Instance Methods

report() click to toggle source
# File lib/defekt/runner.rb, line 18
def report
  puts nil, nil
  puts report_broken, nil if collection.broken.any?
  puts statistics
  self
end
run() click to toggle source
# File lib/defekt/runner.rb, line 11
def run
  @benchmark = Benchmark.measure do
    collection.all.shuffle.each { |test| print test.run }
  end
  self
end
statistics() click to toggle source
# File lib/defekt/runner.rb, line 25
def statistics
  "#{collection.passed.length} passed, #{collection.failed.length} failed" +
    ", #{collection.errored.length} errored of #{collection.all.length} " +
    "tests (in #{benchmark.real.round(3)} seconds)"
end

Private Instance Methods

report_broken() click to toggle source
# File lib/defekt/runner.rb, line 33
def report_broken
  collection.broken.flat_map do |test|
    [test.summary, "  #{test.error.message}"]
  end.join("\n")
end