Make Example#group abstract

Instead of passing parent group as an argument, define the group method 
in the exapmle class created by the #it macro.
This commit is contained in:
Michael Miller 2018-09-19 21:50:51 -06:00
parent 0f7640411f
commit bb7f036a82
2 changed files with 6 additions and 6 deletions

View file

@ -140,10 +140,13 @@ module Spectator
def description def description
{{description.is_a?(StringLiteral) ? description : description.stringify}} {{description.is_a?(StringLiteral) ? description : description.stringify}}
end end
def group
::Spectator::Definitions::GROUPS[{{@type.symbolize}}]
end
end end
%group = ::Spectator::Definitions::GROUPS[\{{@type.symbolize}}] ::Spectator::Definitions::GROUPS[\{{@type.symbolize}}].children << Example%example.new
%group.children << Example%example.new(%group)
end end
macro pending(description, &block) macro pending(description, &block)

View file

@ -1,12 +1,9 @@
module Spectator module Spectator
abstract class Example abstract class Example
getter group : ExampleGroup
getter? finished = false getter? finished = false
def initialize(@group)
end
abstract def run : Result abstract def run : Result
abstract def description : String abstract def description : String
abstract def group : ExampleGroup
end end
end end