Remove RunOrder

Examples will be sorted by using the decorator pattern.The collection of
examples will be wrapped when a custom run order isused.
This commit is contained in:
Michael Miller 2018-09-07 15:06:57 -06:00
parent cb0ae516ae
commit 27e3f00d70
3 changed files with 1 additions and 20 deletions

View file

@ -1,9 +0,0 @@
require "./run_order"
module Spectator
private class DefinedRunOrder < RunOrder
def sort(a : Example, b : Example) : Int32
0
end
end
end

View file

@ -1,5 +0,0 @@
module Spectator
private abstract class RunOrder
abstract def sort(a : Example, b : Example) : Int32
end
end

View file

@ -4,7 +4,6 @@ require "./successful_example_result"
module Spectator
class Runner
def initialize(@examples : Enumerable(Example),
@run_order : RunOrder = DefinedRunOrder.new,
@reporter : Reporters::Reporter = Reporters::StandardReporter.new)
end
@ -12,7 +11,7 @@ module Spectator
results = [] of ExampleResult
elapsed = Time.measure do
@reporter.start_suite
results = sorted_examples.map do |example|
results = @examples.map do |example|
@reporter.start_example(example)
run_example(example).tap do |result|
@reporter.end_example(result)
@ -23,10 +22,6 @@ module Spectator
@reporter.end_suite(report)
end
private def sorted_examples
@examples.to_a.sort { |a, b| @run_order.sort(a, b) }
end
private def run_example(example)
error = nil
elapsed = Time.measure do