Pass group to example initializer

This commit is contained in:
Michael Miller 2018-09-23 12:16:38 -06:00
parent 09184f4a2a
commit ecba0d00ec
3 changed files with 4 additions and 8 deletions

View file

@ -4,8 +4,8 @@ module Spectator
def initialize(@example_type : Example.class)
end
def build(locals : Hash(Symbol, ValueWrapper)) : Example
@example_type.new(locals)
def build(group : ExampleGroup, locals : Hash(Symbol, ValueWrapper)) : Example
@example_type.new(group, locals)
end
end
end

View file

@ -159,10 +159,6 @@ module Spectator
def description
{{description.is_a?(StringLiteral) ? description : description.stringify}}
end
def group
nil # TODO
end
end
::Spectator::DSL::Builder.add_example(Example%example)

View file

@ -1,12 +1,12 @@
module Spectator
abstract class Example
getter? finished = false
getter group : ExampleGroup
abstract def run : Result
abstract def description : String
abstract def group : ExampleGroup
def initialize(@locals = {} of Symbol => ValueWrapper)
def initialize(@group, @locals = {} of Symbol => ValueWrapper)
end
private getter locals