mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Rename ValueExpectation to Expectation in tests
This commit is contained in:
parent
1ce594051c
commit
ff4e148509
2 changed files with 14 additions and 14 deletions
|
@ -1,13 +1,13 @@
|
||||||
require "../spec_helper"
|
require "../spec_helper"
|
||||||
|
|
||||||
describe Spectator::Expectations::ValueExpectation do
|
describe Spectator::Expectations::Expectation do
|
||||||
describe "#satisifed?" do
|
describe "#satisifed?" do
|
||||||
context "with a successful match" do
|
context "with a successful match" do
|
||||||
it "is true" do
|
it "is true" do
|
||||||
value = 42
|
value = 42
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(true, false, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher)
|
||||||
matcher.match?(partial).should be_true # Sanity check.
|
matcher.match?(partial).should be_true # Sanity check.
|
||||||
expectation.satisfied?.should be_true
|
expectation.satisfied?.should be_true
|
||||||
end
|
end
|
||||||
|
@ -17,7 +17,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value = 42
|
value = 42
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(true, true, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher)
|
||||||
matcher.match?(partial).should be_true # Sanity check.
|
matcher.match?(partial).should be_true # Sanity check.
|
||||||
expectation.satisfied?.should be_false
|
expectation.satisfied?.should be_false
|
||||||
end
|
end
|
||||||
|
@ -30,7 +30,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value2 = 777
|
value2 = 777
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(false, false, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher)
|
||||||
matcher.match?(partial).should be_false # Sanity check.
|
matcher.match?(partial).should be_false # Sanity check.
|
||||||
expectation.satisfied?.should be_false
|
expectation.satisfied?.should be_false
|
||||||
end
|
end
|
||||||
|
@ -41,7 +41,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value2 = 777
|
value2 = 777
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(false, true, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher)
|
||||||
matcher.match?(partial).should be_false # Sanity check.
|
matcher.match?(partial).should be_false # Sanity check.
|
||||||
expectation.satisfied?.should be_true
|
expectation.satisfied?.should be_true
|
||||||
end
|
end
|
||||||
|
@ -55,7 +55,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value = 42
|
value = 42
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(true, false, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher)
|
||||||
matcher.match?(partial).should be_true # Sanity check.
|
matcher.match?(partial).should be_true # Sanity check.
|
||||||
expectation.actual_message.should eq(matcher.message(partial))
|
expectation.actual_message.should eq(matcher.message(partial))
|
||||||
end
|
end
|
||||||
|
@ -65,7 +65,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value = 42
|
value = 42
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(true, true, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher)
|
||||||
matcher.match?(partial).should be_true # Sanity check.
|
matcher.match?(partial).should be_true # Sanity check.
|
||||||
expectation.actual_message.should eq(matcher.negated_message(partial))
|
expectation.actual_message.should eq(matcher.negated_message(partial))
|
||||||
end
|
end
|
||||||
|
@ -78,7 +78,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value2 = 777
|
value2 = 777
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(false, false, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher)
|
||||||
matcher.match?(partial).should be_false # Sanity check.
|
matcher.match?(partial).should be_false # Sanity check.
|
||||||
expectation.actual_message.should eq(matcher.negated_message(partial))
|
expectation.actual_message.should eq(matcher.negated_message(partial))
|
||||||
end
|
end
|
||||||
|
@ -89,7 +89,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value2 = 777
|
value2 = 777
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(false, true, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher)
|
||||||
matcher.match?(partial).should be_false # Sanity check.
|
matcher.match?(partial).should be_false # Sanity check.
|
||||||
expectation.actual_message.should eq(matcher.message(partial))
|
expectation.actual_message.should eq(matcher.message(partial))
|
||||||
end
|
end
|
||||||
|
@ -103,7 +103,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value = 42
|
value = 42
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(true, false, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher)
|
||||||
matcher.match?(partial).should be_true # Sanity check.
|
matcher.match?(partial).should be_true # Sanity check.
|
||||||
expectation.expected_message.should eq(matcher.message(partial))
|
expectation.expected_message.should eq(matcher.message(partial))
|
||||||
end
|
end
|
||||||
|
@ -113,7 +113,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value = 42
|
value = 42
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(true, true, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher)
|
||||||
matcher.match?(partial).should be_true # Sanity check.
|
matcher.match?(partial).should be_true # Sanity check.
|
||||||
expectation.expected_message.should eq(matcher.negated_message(partial))
|
expectation.expected_message.should eq(matcher.negated_message(partial))
|
||||||
end
|
end
|
||||||
|
@ -126,7 +126,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value2 = 777
|
value2 = 777
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(false, false, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher)
|
||||||
matcher.match?(partial).should be_false # Sanity check.
|
matcher.match?(partial).should be_false # Sanity check.
|
||||||
expectation.expected_message.should eq(matcher.message(partial))
|
expectation.expected_message.should eq(matcher.message(partial))
|
||||||
end
|
end
|
||||||
|
@ -137,7 +137,7 @@ describe Spectator::Expectations::ValueExpectation do
|
||||||
value2 = 777
|
value2 = 777
|
||||||
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
|
||||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||||
expectation = Spectator::Expectations::ValueExpectation.new(false, true, partial, matcher)
|
expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher)
|
||||||
matcher.match?(partial).should be_false # Sanity check.
|
matcher.match?(partial).should be_false # Sanity check.
|
||||||
expectation.expected_message.should eq(matcher.negated_message(partial))
|
expectation.expected_message.should eq(matcher.negated_message(partial))
|
||||||
end
|
end
|
|
@ -20,7 +20,7 @@ def new_expectation(expected : ExpectedType = 123, actual : ActualType = 123) fo
|
||||||
partial = new_partial("foo", actual)
|
partial = new_partial("foo", actual)
|
||||||
matcher = new_matcher("bar", expected)
|
matcher = new_matcher("bar", expected)
|
||||||
matched = matcher.match?(partial)
|
matched = matcher.match?(partial)
|
||||||
Spectator::Expectations::ValueExpectation.new(matched, false, partial, matcher).as(Spectator::Expectations::Expectation)
|
Spectator::Expectations::Expectation.new(matched, false, partial, matcher)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_satisfied_expectation(value : T = 123) forall T
|
def new_satisfied_expectation(value : T = 123) forall T
|
||||||
|
|
Loading…
Reference in a new issue