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) def initialize(@example_type : Example.class)
end end
def build(locals : Hash(Symbol, ValueWrapper)) : Example def build(group : ExampleGroup, locals : Hash(Symbol, ValueWrapper)) : Example
@example_type.new(locals) @example_type.new(group, locals)
end end
end end
end end

View file

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

View file

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