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
|
@ -102,7 +102,7 @@ describe Spectator::Matchers::CaseMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::CaseMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::CaseMatcher.new(value, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -137,7 +137,7 @@ describe Spectator::Matchers::CaseMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::CaseMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::CaseMatcher.new(value, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ describe Spectator::Matchers::ContainMatcher do
|
|||
search = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::ContainMatcher.new(label, {search})
|
||||
matcher = Spectator::Matchers::ContainMatcher.new({search}, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -310,7 +310,7 @@ describe Spectator::Matchers::ContainMatcher do
|
|||
search = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::ContainMatcher.new(label, {search})
|
||||
matcher = Spectator::Matchers::ContainMatcher.new({search}, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ describe Spectator::Matchers::EndWithMatcher do
|
|||
last = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EndWithMatcher.new(label, last)
|
||||
matcher = Spectator::Matchers::EndWithMatcher.new(last, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -281,7 +281,7 @@ describe Spectator::Matchers::EndWithMatcher do
|
|||
last = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EndWithMatcher.new(label, last)
|
||||
matcher = Spectator::Matchers::EndWithMatcher.new(last, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ describe Spectator::Matchers::EqualityMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value, label)
|
||||
match_data = matcher.match(partial)
|
||||
match_data.message.should contain(label)
|
||||
end
|
||||
|
@ -130,7 +130,7 @@ describe Spectator::Matchers::EqualityMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::EqualityMatcher.new(value, label)
|
||||
match_data = matcher.match(partial)
|
||||
match_data.negated_message.should contain(label)
|
||||
end
|
||||
|
|
|
@ -60,7 +60,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -95,7 +95,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::GreaterThanMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::GreaterThanMatcher.new(value, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -95,7 +95,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::GreaterThanMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::GreaterThanMatcher.new(value, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ describe Spectator::Matchers::AttributesMatcher do
|
|||
attributes = {size: 6}
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::AttributesMatcher.new(label, attributes)
|
||||
matcher = Spectator::Matchers::AttributesMatcher.new(attributes, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -265,7 +265,7 @@ describe Spectator::Matchers::AttributesMatcher do
|
|||
attributes = {size: 6}
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::AttributesMatcher.new(label, attributes)
|
||||
matcher = Spectator::Matchers::AttributesMatcher.new(attributes, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
|
|||
key = :foo
|
||||
label = "blah"
|
||||
partial = new_partial(tuple)
|
||||
matcher = Spectator::Matchers::HaveKeyMatcher.new(label, key)
|
||||
matcher = Spectator::Matchers::HaveKeyMatcher.new(key, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -92,7 +92,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
|
|||
key = :foo
|
||||
label = "blah"
|
||||
partial = new_partial(tuple)
|
||||
matcher = Spectator::Matchers::HaveKeyMatcher.new(label, key)
|
||||
matcher = Spectator::Matchers::HaveKeyMatcher.new(key, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -479,7 +479,7 @@ describe Spectator::Matchers::HaveMatcher do
|
|||
search = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::HaveMatcher.new(label, {search})
|
||||
matcher = Spectator::Matchers::HaveMatcher.new({search}, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -509,7 +509,7 @@ describe Spectator::Matchers::HaveMatcher do
|
|||
search = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::HaveMatcher.new(label, {search})
|
||||
matcher = Spectator::Matchers::HaveMatcher.new({search}, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ describe Spectator::Matchers::HaveValueMatcher do
|
|||
value = "bar"
|
||||
label = "blah"
|
||||
partial = new_partial(hash)
|
||||
matcher = Spectator::Matchers::HaveValueMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::HaveValueMatcher.new(value, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -68,7 +68,7 @@ describe Spectator::Matchers::HaveValueMatcher do
|
|||
value = "bar"
|
||||
label = "blah"
|
||||
partial = new_partial(hash)
|
||||
matcher = Spectator::Matchers::HaveValueMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::HaveValueMatcher.new(value, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ describe Spectator::Matchers::InequalityMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::InequalityMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::InequalityMatcher.new(value, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -117,7 +117,7 @@ describe Spectator::Matchers::InequalityMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::InequalityMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::InequalityMatcher.new(value, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::LessThanEqualMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -95,7 +95,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::LessThanEqualMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ describe Spectator::Matchers::LessThanMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::LessThanMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::LessThanMatcher.new(value, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -95,7 +95,7 @@ describe Spectator::Matchers::LessThanMatcher do
|
|||
value = 42
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::LessThanMatcher.new(label, value)
|
||||
matcher = Spectator::Matchers::LessThanMatcher.new(value, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -180,7 +180,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -252,7 +252,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 3
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, diff).of(center)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(diff, label).of(center)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -282,7 +282,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 3
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, diff).of(center)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(diff, label).of(center)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -380,7 +380,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
@ -407,7 +407,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
@ -478,7 +478,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
@ -497,7 +497,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
@ -578,7 +578,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
@ -605,7 +605,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
@ -676,7 +676,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
@ -695,7 +695,7 @@ describe Spectator::Matchers::RangeMatcher do
|
|||
value = 5
|
||||
label = "foobar"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
|
||||
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ describe Spectator::Matchers::RegexMatcher do
|
|||
label = "different"
|
||||
pattern = /foo/
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RegexMatcher.new(label, pattern)
|
||||
matcher = Spectator::Matchers::RegexMatcher.new(pattern, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -92,7 +92,7 @@ describe Spectator::Matchers::RegexMatcher do
|
|||
label = "different"
|
||||
pattern = /foo/
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::RegexMatcher.new(label, pattern)
|
||||
matcher = Spectator::Matchers::RegexMatcher.new(pattern, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ describe Spectator::Matchers::StartWithMatcher do
|
|||
start = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::StartWithMatcher.new(label, start)
|
||||
matcher = Spectator::Matchers::StartWithMatcher.new(start, label)
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
@ -281,7 +281,7 @@ describe Spectator::Matchers::StartWithMatcher do
|
|||
start = "baz"
|
||||
label = "everything"
|
||||
partial = new_partial(value)
|
||||
matcher = Spectator::Matchers::StartWithMatcher.new(label, start)
|
||||
matcher = Spectator::Matchers::StartWithMatcher.new(start, label)
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue