Class: Defekt::Runner
Instance Attribute Summary collapse
-
#benchmark ⇒ Object
readonly
Returns the value of attribute benchmark.
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Instance Method Summary collapse
-
#initialize(collection) ⇒ Runner
constructor
A new instance of Runner.
- #report ⇒ Object
- #run ⇒ Object
- #statistics ⇒ Object
Constructor Details
#initialize(collection) ⇒ Runner
Returns a new instance of Runner.
7 8 9 |
# File 'lib/defekt/runner.rb', line 7 def initialize(collection) @collection = collection end |
Instance Attribute Details
#benchmark ⇒ Object (readonly)
Returns the value of attribute benchmark.
5 6 7 |
# File 'lib/defekt/runner.rb', line 5 def benchmark @benchmark end |
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
5 6 7 |
# File 'lib/defekt/runner.rb', line 5 def collection @collection end |
Instance Method Details
#report ⇒ Object
18 19 20 21 22 23 |
# 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 ⇒ Object
11 12 13 14 15 16 |
# 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 ⇒ Object
25 26 27 28 29 |
# 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 |