mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix oddity with type being unresolvable
This commit is contained in:
parent
c1f61d68bf
commit
26187a0f31
2 changed files with 10 additions and 4 deletions
|
@ -35,9 +35,15 @@ def new_unsatisfied_expectation(expected : ExpectedType = 123, actual : ActualTy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_expectations(success_count = 1, failure_count = 0)
|
||||||
|
satisfied = Array(Spectator::Expectations::Expectation).new(success_count) { new_satisfied_expectation }
|
||||||
|
unsatisfied = Array(Spectator::Expectations::Expectation).new(failure_count) { new_unsatisfied_expectation }
|
||||||
|
(satisfied + unsatisfied).shuffle
|
||||||
|
end
|
||||||
|
|
||||||
def generate_expectations(success_count = 1, failure_count = 0)
|
def generate_expectations(success_count = 1, failure_count = 0)
|
||||||
satisfied = Array.new(success_count) { new_satisfied_expectation }
|
satisfied = Array(Spectator::Expectations::Expectation).new(success_count) { new_satisfied_expectation }
|
||||||
unsatisfied = Array.new(failure_count) { new_unsatisfied_expectation }
|
unsatisfied = Array(Spectator::Expectations::Expectation).new(failure_count) { new_unsatisfied_expectation }
|
||||||
expectations = (satisfied + unsatisfied).shuffle
|
expectations = (satisfied + unsatisfied).shuffle
|
||||||
reporter = Spectator::Expectations::ExpectationReporter.new(false)
|
reporter = Spectator::Expectations::ExpectationReporter.new(false)
|
||||||
expectations.each do |expectation|
|
expectations.each do |expectation|
|
||||||
|
|
|
@ -8,7 +8,7 @@ def new_successful_result(
|
||||||
Spectator::SuccessfulResult.new(
|
Spectator::SuccessfulResult.new(
|
||||||
example || PassingExample.create,
|
example || PassingExample.create,
|
||||||
elapsed || Time::Span.zero,
|
elapsed || Time::Span.zero,
|
||||||
expectations || Spectator::Expectations::ExampleExpectations.new(generate_expectations(1, 0)[:expectations])
|
expectations || Spectator::Expectations::ExampleExpectations.new([new_satisfied_expectation])
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ describe Spectator::SuccessfulResult do
|
||||||
|
|
||||||
describe "#expectations" do
|
describe "#expectations" do
|
||||||
it "is the expected value" do
|
it "is the expected value" do
|
||||||
expectations = Spectator::Expectations::ExampleExpectations.new(generate_expectations(5, 0)[:expectations])
|
expectations = Spectator::Expectations::ExampleExpectations.new(create_expectations(5, 0))
|
||||||
result = new_successful_result(expectations: expectations)
|
result = new_successful_result(expectations: expectations)
|
||||||
result.expectations.should eq(expectations)
|
result.expectations.should eq(expectations)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue