mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
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:
parent
cb0ae516ae
commit
27e3f00d70
3 changed files with 1 additions and 20 deletions
|
@ -1,9 +0,0 @@
|
|||
require "./run_order"
|
||||
|
||||
module Spectator
|
||||
private class DefinedRunOrder < RunOrder
|
||||
def sort(a : Example, b : Example) : Int32
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
module Spectator
|
||||
private abstract class RunOrder
|
||||
abstract def sort(a : Example, b : Example) : Int32
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue