Rig up the harness

This commit is contained in:
Michael Miller 2018-10-09 14:25:52 -06:00
parent bfb133f44d
commit f5317ecbd3
3 changed files with 4 additions and 5 deletions

View file

@ -23,7 +23,7 @@ module Spectator::Expectations
def to(matcher : Matchers::ValueMatcher(ExpectedType)) : Nil forall ExpectedType def to(matcher : Matchers::ValueMatcher(ExpectedType)) : Nil forall ExpectedType
expectation = ValueExpectation.new(self, matcher) expectation = ValueExpectation.new(self, matcher)
result = expectation.eval result = expectation.eval
ExpectationRegistry.current.report(result) Internals::Harness.current.reporter.report(result)
end end
# Asserts that the `#actual` value *does not* match some criteria. # 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 def to_not(matcher : Matchers::ValueMatcher(ExpectedType)) : Nil forall ExpectedType
expectation = ValueExpectation.new(self, matcher) expectation = ValueExpectation.new(self, matcher)
result = expectation.eval(true) result = expectation.eval(true)
ExpectationRegistry.current.report(result) Internals::Harness.current.reporter.report(result)
end end
# ditto # ditto

View file

@ -3,7 +3,6 @@ require "./example"
module Spectator module Spectator
abstract class RunnableExample < Example abstract class RunnableExample < Example
def run def run
Expectations::ExpectationRegistry.start(self)
result = ResultCapture.new result = ResultCapture.new
group.run_before_all_hooks group.run_before_all_hooks
group.run_before_each_hooks group.run_before_each_hooks
@ -14,7 +13,7 @@ module Spectator
group.run_after_each_hooks group.run_after_each_hooks
group.run_after_all_hooks group.run_after_all_hooks
end end
expectations = Expectations::ExpectationRegistry.finish expectations = Internals::Harness.current.reporter.results
translate_result(result, expectations) translate_result(result, expectations)
end end

View file

@ -10,7 +10,7 @@ module Spectator
@formatter.start_suite @formatter.start_suite
results = @group.all_examples.map do |example| results = @group.all_examples.map do |example|
@formatter.start_example(example) @formatter.start_example(example)
example.run.tap do |result| Internals::Harness.run(example).tap do |result|
@formatter.end_example(result) @formatter.end_example(result)
end.as(Result) end.as(Result)
end end