Remove references to ExampleGroup

This commit is contained in:
Michael Miller 2021-03-31 16:24:52 -06:00
parent bf17bc95ac
commit 9269cbd6cc
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -1,5 +1,4 @@
require "./example"
require "./example_group"
require "./spec/node"
module Spectator
@ -13,7 +12,7 @@ module Spectator
# Creates a new iterator.
# The *group* is the example group to iterate through.
def initialize(@group : ExampleGroup)
def initialize(@group : Iterable(Spec::Node))
iter = @group.each.as(Iterator(Spec::Node))
@stack = [iter]
end
@ -49,13 +48,14 @@ module Spectator
@stack.last
end
# Retrieves the next "thing" from the tree.
# This method will return an `Example` or "something else."
# Retrieves the next node from the tree.
# This method will return an `Example` or some other type of node.
# If the node is iterable, it is pushed onto the stack before returning it.
private def advance
# Get the iterator from the top of the stack.
# Advance the iterator and check what the next item is.
case (item = top.next)
when ExampleGroup
when Iterable(Spec::Node)
# If the next thing is a group,
# we need to traverse its branch.
# Push its iterator onto the stack and return.