From f5317ecbd3c4779a0bc78340d808b509be955a50 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Tue, 9 Oct 2018 14:25:52 -0600 Subject: [PATCH] Rig up the harness --- src/spectator/expectations/value_expectation_partial.cr | 4 ++-- src/spectator/runnable_example.cr | 3 +-- src/spectator/runner.cr | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/spectator/expectations/value_expectation_partial.cr b/src/spectator/expectations/value_expectation_partial.cr index a9767d9..1fad240 100644 --- a/src/spectator/expectations/value_expectation_partial.cr +++ b/src/spectator/expectations/value_expectation_partial.cr @@ -23,7 +23,7 @@ module Spectator::Expectations def to(matcher : Matchers::ValueMatcher(ExpectedType)) : Nil forall ExpectedType expectation = ValueExpectation.new(self, matcher) result = expectation.eval - ExpectationRegistry.current.report(result) + Internals::Harness.current.reporter.report(result) end # Asserts that the `#actual` value *does not* match some criteria. @@ -31,7 +31,7 @@ module Spectator::Expectations def to_not(matcher : Matchers::ValueMatcher(ExpectedType)) : Nil forall ExpectedType expectation = ValueExpectation.new(self, matcher) result = expectation.eval(true) - ExpectationRegistry.current.report(result) + Internals::Harness.current.reporter.report(result) end # ditto diff --git a/src/spectator/runnable_example.cr b/src/spectator/runnable_example.cr index 354ebba..44631d9 100644 --- a/src/spectator/runnable_example.cr +++ b/src/spectator/runnable_example.cr @@ -3,7 +3,6 @@ require "./example" module Spectator abstract class RunnableExample < Example def run - Expectations::ExpectationRegistry.start(self) result = ResultCapture.new group.run_before_all_hooks group.run_before_each_hooks @@ -14,7 +13,7 @@ module Spectator group.run_after_each_hooks group.run_after_all_hooks end - expectations = Expectations::ExpectationRegistry.finish + expectations = Internals::Harness.current.reporter.results translate_result(result, expectations) end diff --git a/src/spectator/runner.cr b/src/spectator/runner.cr index a5e18e5..514714b 100644 --- a/src/spectator/runner.cr +++ b/src/spectator/runner.cr @@ -10,7 +10,7 @@ module Spectator @formatter.start_suite results = @group.all_examples.map do |example| @formatter.start_example(example) - example.run.tap do |result| + Internals::Harness.run(example).tap do |result| @formatter.end_example(result) end.as(Result) end