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
{{description.is_a?(StringLiteral) ? description : description.stringify}}
end
def group
::Spectator::Definitions::GROUPS[{{@type.symbolize}}]
end
end
%group = ::Spectator::Definitions::GROUPS[\{{@type.symbolize}}]
%group.children << Example%example.new(%group)
::Spectator::Definitions::GROUPS[\{{@type.symbolize}}].children << Example%example.new
end
macro pending(description, &block)

View File

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