From 7e6080aa5f6bc71c1489fc1ba00fa5366b5d0c4c Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Thu, 26 Sep 2019 15:11:54 -0600 Subject: [PATCH] Move harness out of internals --- src/spectator/expectations/expectation_partial.cr | 2 +- src/spectator/{internals => }/harness.cr | 4 ++-- src/spectator/runnable_example.cr | 2 +- src/spectator/runner.cr | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename src/spectator/{internals => }/harness.cr (96%) diff --git a/src/spectator/expectations/expectation_partial.cr b/src/spectator/expectations/expectation_partial.cr index 1cc8831..ed2e33c 100644 --- a/src/spectator/expectations/expectation_partial.cr +++ b/src/spectator/expectations/expectation_partial.cr @@ -40,7 +40,7 @@ module Spectator::Expectations # Reports an expectation to the current harness. private def report(match_data : Matchers::MatchData) expectation = Expectation.new(match_data, @source) - Internals::Harness.current.report_expectation(expectation) + Harness.current.report_expectation(expectation) end end end diff --git a/src/spectator/internals/harness.cr b/src/spectator/harness.cr similarity index 96% rename from src/spectator/internals/harness.cr rename to src/spectator/harness.cr index 8f70045..8fe0070 100644 --- a/src/spectator/internals/harness.cr +++ b/src/spectator/harness.cr @@ -1,4 +1,4 @@ -module Spectator::Internals +module Spectator # Helper class that acts as a gateway between example code and the test framework. # Every example must be invoked by passing it to `#run`. # This sets up the harness so that the example code can use it. @@ -9,7 +9,7 @@ module Spectator::Internals # ``` # Then from the example code, the harness can be accessed via `#current` like so: # ``` - # harness = ::Spectator::Internals::Harness.current + # harness = ::Spectator::Harness.current # # Do something with the harness. # ``` # Of course, the end-user shouldn't see this or work directly with the harness. diff --git a/src/spectator/runnable_example.cr b/src/spectator/runnable_example.cr index e56f7d2..c608619 100644 --- a/src/spectator/runnable_example.cr +++ b/src/spectator/runnable_example.cr @@ -8,7 +8,7 @@ module Spectator # and translates to a usable result. def run_impl : Result result = capture_result - expectations = Internals::Harness.current.expectations + expectations = Harness.current.expectations translate_result(result, expectations) end diff --git a/src/spectator/runner.cr b/src/spectator/runner.cr index 1229ebf..bf2e53c 100644 --- a/src/spectator/runner.cr +++ b/src/spectator/runner.cr @@ -1,4 +1,4 @@ -require "./internals/harness" +require "./harness" module Spectator # Main driver for executing tests and feeding results to formatters. @@ -59,7 +59,7 @@ module Spectator result = if @config.dry_run? && example.is_a?(RunnableExample) dry_run_result(example) else - Internals::Harness.run(example) + Harness.run(example) end @config.each_formatter(&.end_example(result)) result