mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Implement remaining harness specs
This commit is contained in:
parent
5a4b4817b4
commit
3382084f03
1 changed files with 31 additions and 2 deletions
|
@ -53,7 +53,15 @@ describe Spectator::Internals::Harness do
|
||||||
describe "#report_expectation" do
|
describe "#report_expectation" do
|
||||||
context "with a successful result" do
|
context "with a successful result" do
|
||||||
it "stores the result" do
|
it "stores the result" do
|
||||||
|
error = nil.as(Exception?)
|
||||||
|
success = new_successful_result
|
||||||
|
spy = SpyExample.create do
|
||||||
|
harness = Spectator::Internals::Harness.current
|
||||||
|
harness.report_expectation(success)
|
||||||
|
end
|
||||||
|
result = Spectator::Internals::Harness.run(spy)
|
||||||
|
result.should be_a(Spectator::SuccessfulResult)
|
||||||
|
result.as(Spectator::SuccessfulResult).expectations.should contain(success)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,12 +79,33 @@ describe Spectator::Internals::Harness do
|
||||||
Spectator::Internals::Harness.run(spy)
|
Spectator::Internals::Harness.run(spy)
|
||||||
error.should be_a(Spectator::ExampleFailed)
|
error.should be_a(Spectator::ExampleFailed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "stores the result" do
|
||||||
|
error = nil.as(Exception?)
|
||||||
|
failure = new_failure_result
|
||||||
|
spy = SpyExample.create do
|
||||||
|
harness = Spectator::Internals::Harness.current
|
||||||
|
harness.report_expectation(failure)
|
||||||
|
end
|
||||||
|
result = Spectator::Internals::Harness.run(spy)
|
||||||
|
result.should be_a(Spectator::FailedResult)
|
||||||
|
result.as(Spectator::FailedResult).expectations.should contain(failure)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#expectation_results" do
|
describe "#expectation_results" do
|
||||||
it "contains the reported results" do
|
it "contains the reported results" do
|
||||||
|
results = [new_successful_result, new_failure_result]
|
||||||
|
spy = SpyExample.create do
|
||||||
|
harness = Spectator::Internals::Harness.current
|
||||||
|
results.each do |result|
|
||||||
|
harness.report_expectation(result)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result = Spectator::Internals::Harness.run(spy)
|
||||||
|
reported_results = result.as(Spectator::FailedResult).expectations.to_a
|
||||||
|
(results - reported_results).size.should eq(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue