From ec6018bed4ab024b5627fb0b55a57572a82de187 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 27 Sep 2020 09:10:27 -0600 Subject: [PATCH] Start reactivating runner --- src/spectator.cr | 4 ++-- src/spectator/example.cr | 2 ++ src/spectator/spec.cr | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/spectator.cr b/src/spectator.cr index d3e63fe..a6708af 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -93,8 +93,8 @@ module Spectator # Builds the tests and runs the framework. private def run - # Build the test suite and run it. - # suite = ::Spectator::SpecBuilder.build(config.example_filter) + # Build the test spec and run it. + spec = ::Spectator::DSL::Builder.build # Runner.new(suite, config).run true rescue ex diff --git a/src/spectator/example.cr b/src/spectator/example.cr index b3c254e..e5607e2 100644 --- a/src/spectator/example.cr +++ b/src/spectator/example.cr @@ -28,6 +28,8 @@ module Spectator # Returns the result of the execution. # The result will also be stored in `#result`. def run : Result + Spectator.debug_out("Running example #{example}") + @delegate.call(self) raise NotImplementedError.new("#run") end diff --git a/src/spectator/spec.cr b/src/spectator/spec.cr index ebe3f9d..90a2b6a 100644 --- a/src/spectator/spec.cr +++ b/src/spectator/spec.cr @@ -1,6 +1,21 @@ -require "./spec/*" +require "./example" +require "./example_group" module Spectator class Spec + include Enumerable(Example) + + def initialize(@group : ExampleGroup) + end + + def each + @group.each do |node| + if (example = node.as?(Example)) + yield example + elsif (group = node.as?(ExampleGroup)) + # TODO + end + end + end end end