mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Swap label and expected value parameters
This matches the partial initializer parameters. Also cleaned up some code in the Expectation spec.
This commit is contained in:
parent
f3e50c6432
commit
5ba03a90ff
20 changed files with 74 additions and 110 deletions
|
@ -5,10 +5,8 @@ describe Spectator::Expectations::Expectation do
|
|||
context "with a successful match" do
|
||||
it "is true" do
|
||||
value = 42
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_true # Sanity check.
|
||||
match_data = new_matcher(value).match(new_partial(value))
|
||||
match_data.matched?.should be_true # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, false)
|
||||
expectation.satisfied?.should be_true
|
||||
end
|
||||
|
@ -16,10 +14,8 @@ describe Spectator::Expectations::Expectation do
|
|||
context "when negated" do
|
||||
it "is false" do
|
||||
value = 42
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_true # Sanity check.
|
||||
match_data = new_matcher(value).match(new_partial(value))
|
||||
match_data.matched?.should be_true # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, true)
|
||||
expectation.satisfied?.should be_false
|
||||
end
|
||||
|
@ -28,24 +24,16 @@ describe Spectator::Expectations::Expectation do
|
|||
|
||||
context "with an unsuccessful match" do
|
||||
it "is false" do
|
||||
value1 = 42
|
||||
value2 = 777
|
||||
partial = new_partial(value1)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_false # Sanity check.
|
||||
match_data = new_matcher(42).match(new_partial(777))
|
||||
match_data.matched?.should be_false # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, false)
|
||||
expectation.satisfied?.should be_false
|
||||
end
|
||||
|
||||
context "when negated" do
|
||||
it "is true" do
|
||||
value1 = 42
|
||||
value2 = 777
|
||||
partial = new_partial(value1)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_false # Sanity check.
|
||||
match_data = new_matcher(42).match(new_partial(777))
|
||||
match_data.matched?.should be_false # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, true)
|
||||
expectation.satisfied?.should be_true
|
||||
end
|
||||
|
@ -57,9 +45,7 @@ describe Spectator::Expectations::Expectation do
|
|||
context "with a successful match" do
|
||||
it "equals the matcher's #message" do
|
||||
value = 42
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||
match_data = matcher.match(partial)
|
||||
match_data = new_matcher(value).match(new_partial(value))
|
||||
match_data.matched?.should be_true # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, false)
|
||||
expectation.actual_message.should eq(match_data.message)
|
||||
|
@ -68,10 +54,8 @@ describe Spectator::Expectations::Expectation do
|
|||
context "when negated" do
|
||||
it "equals the matcher's #negated_message" do
|
||||
value = 42
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_true # Sanity check.
|
||||
match_data = new_matcher(value).match(new_partial(value))
|
||||
match_data.matched?.should be_true # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, true)
|
||||
expectation.actual_message.should eq(match_data.negated_message)
|
||||
end
|
||||
|
@ -80,24 +64,16 @@ describe Spectator::Expectations::Expectation do
|
|||
|
||||
context "with an unsuccessful match" do
|
||||
it "equals the matcher's #negated_message" do
|
||||
value1 = 42
|
||||
value2 = 777
|
||||
partial = new_partial(value1)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_false # Sanity check.
|
||||
match_data = new_matcher(42).match(new_partial(777))
|
||||
match_data.matched?.should be_false # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, false)
|
||||
expectation.actual_message.should eq(match_data.negated_message)
|
||||
end
|
||||
|
||||
context "when negated" do
|
||||
it "equals the matcher's #message" do
|
||||
value1 = 42
|
||||
value2 = 777
|
||||
partial = new_partial(value1)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_false # Sanity check.
|
||||
match_data = new_matcher(42).match(new_partial(777))
|
||||
match_data.matched?.should be_false # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, true)
|
||||
expectation.actual_message.should eq(match_data.message)
|
||||
end
|
||||
|
@ -109,10 +85,8 @@ describe Spectator::Expectations::Expectation do
|
|||
context "with a successful match" do
|
||||
it "equals the matcher's #message" do
|
||||
value = 42
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_true # Sanity check.
|
||||
match_data = new_matcher(value).match(new_partial(value))
|
||||
match_data.matched?.should be_true # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, false)
|
||||
expectation.expected_message.should eq(match_data.message)
|
||||
end
|
||||
|
@ -120,10 +94,8 @@ describe Spectator::Expectations::Expectation do
|
|||
context "when negated" do
|
||||
it "equals the matcher's #negated_message" do
|
||||
value = 42
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_true # Sanity check.
|
||||
match_data = new_matcher(value).match(new_partial(value))
|
||||
match_data.matched?.should be_true # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, true)
|
||||
expectation.expected_message.should eq(match_data.negated_message)
|
||||
end
|
||||
|
@ -132,24 +104,16 @@ describe Spectator::Expectations::Expectation do
|
|||
|
||||
context "with an unsuccessful match" do
|
||||
it "equals the matcher's #message" do
|
||||
value1 = 42
|
||||
value2 = 777
|
||||
partial = new_partial(value1)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_false # Sanity check.
|
||||
match_data = new_matcher(42).match(new_partial(777))
|
||||
match_data.matched?.should be_false # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, false)
|
||||
expectation.expected_message.should eq(match_data.message)
|
||||
end
|
||||
|
||||
context "when negated" do
|
||||
it "equals the matcher's #negated_message" do
|
||||
value1 = 42
|
||||
value2 = 777
|
||||
partial = new_partial(value1)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
|
||||
match_data = matcher.match(partial)
|
||||
matcher.match(partial).matched?.should be_false # Sanity check.
|
||||
match_data = new_matcher(42).match(new_partial(777))
|
||||
match_data.matched?.should be_false # Sanity check.
|
||||
expectation = Spectator::Expectations::Expectation.new(match_data, true)
|
||||
expectation.expected_message.should eq(match_data.negated_message)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue