Update specs to use new source arguments

Used `new_partial` where the underlying partial didn't matter for the
test.
This commit is contained in:
Michael Miller 2019-02-14 17:04:59 -07:00
parent ac5c2bbe47
commit 1507a447c8
25 changed files with 439 additions and 439 deletions

View File

@ -5,7 +5,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
context "with a label" do
it "contains the value passed to the constructor" do
actual = ->{ 777 }
partial = Spectator::Expectations::BlockExpectationPartial.new(actual.to_s, actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, actual.to_s, __FILE__, __LINE__)
partial.actual.should eq(actual.call)
end
end
@ -13,7 +13,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
context "without a label" do
it "contains the value passed to the constructor" do
actual = ->{ 777 }
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
partial.actual.should eq(actual.call)
end
end
@ -24,7 +24,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
it "contains the value passed to the constructor" do
actual = ->{ 777 }
label = "lucky"
partial = Spectator::Expectations::BlockExpectationPartial.new(label, actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, label, __FILE__, __LINE__)
partial.label.should eq(label)
end
end
@ -32,7 +32,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
context "when omitted" do
it "contains a stringified version of #actual" do
actual = ->{ 777 }
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
partial.label.should eq(actual.to_s)
end
end
@ -43,7 +43,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 777
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.to(matcher)
end
@ -55,7 +55,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 777
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
5.times { partial.to(matcher) }
end
@ -68,7 +68,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 777
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.to(matcher)
end
@ -82,7 +82,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 42
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.to(matcher)
end
@ -98,7 +98,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 777
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.{{method.id}}(matcher)
end
@ -110,7 +110,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 42
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
5.times { partial.{{method.id}}(matcher) }
end
@ -123,7 +123,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 777
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.{{method.id}}(matcher)
end
@ -137,7 +137,7 @@ describe Spectator::Expectations::BlockExpectationPartial do
spy = SpyExample.create do
actual = ->{ 777 }
expected = 42
partial = Spectator::Expectations::BlockExpectationPartial.new(actual)
partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.{{method.id}}(matcher)
end

View File

@ -5,7 +5,7 @@ describe Spectator::Expectations::Expectation do
context "with a successful match" do
it "is true" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher)
matcher.match?(partial).should be_true # Sanity check.
@ -15,7 +15,7 @@ describe Spectator::Expectations::Expectation do
context "when negated" do
it "is false" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher)
matcher.match?(partial).should be_true # Sanity check.
@ -28,7 +28,7 @@ describe Spectator::Expectations::Expectation do
it "is false" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher)
matcher.match?(partial).should be_false # Sanity check.
@ -39,7 +39,7 @@ describe Spectator::Expectations::Expectation do
it "is true" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher)
matcher.match?(partial).should be_false # Sanity check.
@ -53,7 +53,7 @@ describe Spectator::Expectations::Expectation do
context "with a successful match" do
it "equals the matcher's #message" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher)
matcher.match?(partial).should be_true # Sanity check.
@ -63,7 +63,7 @@ describe Spectator::Expectations::Expectation do
context "when negated" do
it "equals the matcher's #negated_message" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher)
matcher.match?(partial).should be_true # Sanity check.
@ -76,7 +76,7 @@ describe Spectator::Expectations::Expectation do
it "equals the matcher's #negated_message" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher)
matcher.match?(partial).should be_false # Sanity check.
@ -87,7 +87,7 @@ describe Spectator::Expectations::Expectation do
it "equals the matcher's #message" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher)
matcher.match?(partial).should be_false # Sanity check.
@ -101,7 +101,7 @@ describe Spectator::Expectations::Expectation do
context "with a successful match" do
it "equals the matcher's #message" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
expectation = Spectator::Expectations::Expectation.new(true, false, partial, matcher)
matcher.match?(partial).should be_true # Sanity check.
@ -111,7 +111,7 @@ describe Spectator::Expectations::Expectation do
context "when negated" do
it "equals the matcher's #negated_message" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value.to_s, value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value.to_s, value)
expectation = Spectator::Expectations::Expectation.new(true, true, partial, matcher)
matcher.match?(partial).should be_true # Sanity check.
@ -124,7 +124,7 @@ describe Spectator::Expectations::Expectation do
it "equals the matcher's #message" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
expectation = Spectator::Expectations::Expectation.new(false, false, partial, matcher)
matcher.match?(partial).should be_false # Sanity check.
@ -135,7 +135,7 @@ describe Spectator::Expectations::Expectation do
it "equals the matcher's #negated_message" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1.to_s, value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2.to_s, value2)
expectation = Spectator::Expectations::Expectation.new(false, true, partial, matcher)
matcher.match?(partial).should be_false # Sanity check.

View File

@ -5,7 +5,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
context "with a label" do
it "contains the value passed to the constructor" do
actual = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual.to_s, actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, actual.to_s, __FILE__, __LINE__)
partial.actual.should eq(actual)
end
end
@ -13,7 +13,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
context "without a label" do
it "contains the value passed to the constructor" do
actual = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
partial.actual.should eq(actual)
end
end
@ -24,7 +24,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
it "contains the value passed to the constructor" do
actual = 777
label = "lucky"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, label, __FILE__, __LINE__)
partial.label.should eq(label)
end
end
@ -32,7 +32,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
context "when omitted" do
it "contains a stringified version of #actual" do
actual = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
partial.label.should eq(actual.to_s)
end
end
@ -43,7 +43,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.to(matcher)
end
@ -55,7 +55,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
5.times { partial.to(matcher) }
end
@ -68,7 +68,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.to(matcher)
end
@ -82,7 +82,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.to(matcher)
end
@ -98,7 +98,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.{{method.id}}(matcher)
end
@ -110,7 +110,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
5.times { partial.{{method.id}}(matcher) }
end
@ -123,7 +123,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.{{method.id}}(matcher)
end
@ -137,7 +137,7 @@ describe Spectator::Expectations::ValueExpectationPartial do
spy = SpyExample.create do
actual = 777
expected = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
partial.{{method.id}}(matcher)
end

View File

@ -1,11 +1,11 @@
# Utility methods for creating expectations, partials, and matchers.
def new_partial(label : String, actual : T) forall T
Spectator::Expectations::ValueExpectationPartial.new(label, actual)
def new_partial(actual : T, label : String) forall T
Spectator::Expectations::ValueExpectationPartial.new(actual, label, __FILE__, __LINE__)
end
def new_partial(actual : T = 123) forall T
new_partial(actual.to_s, actual)
Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
end
def new_matcher(label : String, expected : T) forall T
@ -17,7 +17,7 @@ def new_matcher(expected : T = 123) forall T
end
def new_expectation(expected : ExpectedType = 123, actual : ActualType = 123) forall ExpectedType, ActualType
partial = new_partial("foo", actual)
partial = new_partial(actual, "foo")
matcher = new_matcher("bar", expected)
matched = matcher.match?(partial)
Spectator::Expectations::Expectation.new(matched, false, partial, matcher)

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::CaseMatcher do
describe "#match?" do
it "compares using #===" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(42)
partial = new_partial(42)
matcher = Spectator::Matchers::CaseMatcher.new(spy)
matcher.match?(partial).should be_true
spy.case_eq_call_count.should be > 0
@ -13,7 +13,7 @@ describe Spectator::Matchers::CaseMatcher do
context "with identical values" do
it "is true" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::CaseMatcher.new(value)
matcher.match?(partial).should be_true
end
@ -23,7 +23,7 @@ describe Spectator::Matchers::CaseMatcher do
it "is false" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::CaseMatcher.new(value2)
matcher.match?(partial).should be_false
end
@ -33,7 +33,7 @@ describe Spectator::Matchers::CaseMatcher do
it "is true" do
# Box is used because it is a reference type and doesn't override the == method.
ref = Box.new([] of Int32)
partial = Spectator::Expectations::ValueExpectationPartial.new(ref)
partial = new_partial(ref)
matcher = Spectator::Matchers::CaseMatcher.new(ref)
matcher.match?(partial).should be_true
end
@ -44,7 +44,7 @@ describe Spectator::Matchers::CaseMatcher do
it "is true" do
array1 = [1, 2, 3]
array2 = [1, 2, 3]
partial = Spectator::Expectations::ValueExpectationPartial.new(array1)
partial = new_partial(array1)
matcher = Spectator::Matchers::CaseMatcher.new(array2)
matcher.match?(partial).should be_true
end
@ -54,7 +54,7 @@ describe Spectator::Matchers::CaseMatcher do
it "is false" do
array1 = [1, 2, 3]
array2 = [4, 5, 6]
partial = Spectator::Expectations::ValueExpectationPartial.new(array1)
partial = new_partial(array1)
matcher = Spectator::Matchers::CaseMatcher.new(array2)
matcher.match?(partial).should be_false
end
@ -64,7 +64,7 @@ describe Spectator::Matchers::CaseMatcher do
it "is true" do
value1 = "foobar"
value2 = String
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::CaseMatcher.new(value2)
matcher.match?(partial).should be_true
end
@ -74,7 +74,7 @@ describe Spectator::Matchers::CaseMatcher do
it "is false" do
value1 = "foobar"
value2 = Array
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::CaseMatcher.new(value2)
matcher.match?(partial).should be_false
end
@ -85,7 +85,7 @@ describe Spectator::Matchers::CaseMatcher do
describe "#message" do
it "mentions ===" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::CaseMatcher.new(value)
matcher.message(partial).should contain("===")
end
@ -93,7 +93,7 @@ describe Spectator::Matchers::CaseMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::CaseMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -101,7 +101,7 @@ describe Spectator::Matchers::CaseMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::CaseMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -110,7 +110,7 @@ describe Spectator::Matchers::CaseMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::CaseMatcher.new(value2)
matcher.message(partial).should contain(value2.to_s)
end
@ -120,7 +120,7 @@ describe Spectator::Matchers::CaseMatcher do
describe "#negated_message" do
it "mentions ===" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::CaseMatcher.new(value)
matcher.negated_message(partial).should contain("===")
end
@ -128,7 +128,7 @@ describe Spectator::Matchers::CaseMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::CaseMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -136,7 +136,7 @@ describe Spectator::Matchers::CaseMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::CaseMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -145,7 +145,7 @@ describe Spectator::Matchers::CaseMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::CaseMatcher.new(value2)
matcher.negated_message(partial).should contain(value2.to_s)
end

View File

@ -8,7 +8,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobarbaz"
search = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -17,7 +17,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobar"
search = "foo"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -27,7 +27,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobar"
search = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -38,7 +38,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobar"
search = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_false
end
@ -48,7 +48,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobar"
search = 'o'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -57,7 +57,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobar"
search = 'f'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -67,7 +67,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobar"
search = 'r'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -78,7 +78,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobar"
search = 'z'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_false
end
@ -90,7 +90,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobarbaz"
search = {"foo", "bar", "baz"}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -100,7 +100,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobarbaz"
search = {"foo", "qux"}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -110,7 +110,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobar"
search = {"baz", "qux"}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -120,7 +120,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobarbaz"
search = {'f', 'b', 'z'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -130,7 +130,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobarbaz"
search = {'f', 'c', 'd'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -140,7 +140,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobarbaz"
search = {'c', 'd', 'e'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -150,7 +150,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
value = "foobarbaz"
search = {"foo", 'z'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -160,7 +160,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobarbaz"
search = {"foo", 'c'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -170,7 +170,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobarbaz"
search = {"qux", 'f'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -180,7 +180,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
value = "foobarbaz"
search = {"qux", 'c'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -194,7 +194,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
array = %i[a b c]
search = :b
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -203,7 +203,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
array = %i[a b c]
search = :a
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -213,7 +213,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
array = %i[a b c]
search = :c
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -224,7 +224,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
array = %i[a b c]
search = :z
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.match?(partial).should be_false
end
@ -236,7 +236,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is true" do
array = %i[a b c]
search = {:a, :b}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -246,7 +246,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
array = %i[a b c]
search = {:a, :d}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -256,7 +256,7 @@ describe Spectator::Matchers::ContainMatcher do
it "is false" do
array = %i[a b c]
search = {:d, :e}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -270,7 +270,7 @@ describe Spectator::Matchers::ContainMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.message(partial).should contain(label)
end
@ -279,7 +279,7 @@ describe Spectator::Matchers::ContainMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(label, {search})
matcher.message(partial).should contain(label)
end
@ -288,7 +288,7 @@ describe Spectator::Matchers::ContainMatcher do
it "contains stringified form of expected value" do
value = "foobar"
search = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.message(partial).should contain(search)
end
@ -300,7 +300,7 @@ describe Spectator::Matchers::ContainMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.negated_message(partial).should contain(label)
end
@ -309,7 +309,7 @@ describe Spectator::Matchers::ContainMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new(label, {search})
matcher.negated_message(partial).should contain(label)
end
@ -318,7 +318,7 @@ describe Spectator::Matchers::ContainMatcher do
it "contains stringified form of expected value" do
value = "foobar"
search = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::ContainMatcher.new({search})
matcher.negated_message(partial).should contain(search)
end

View File

@ -5,7 +5,7 @@ describe Spectator::Matchers::EmptyMatcher do
context "with an empty set" do
it "is true" do
array = [] of Symbol
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EmptyMatcher.new
matcher.match?(partial).should be_true
end
@ -14,7 +14,7 @@ describe Spectator::Matchers::EmptyMatcher do
context "with a filled set" do
it "is false" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EmptyMatcher.new
matcher.match?(partial).should be_false
end
@ -25,7 +25,7 @@ describe Spectator::Matchers::EmptyMatcher do
it "contains the actual label" do
array = %i[a b c]
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, array)
partial = new_partial(array, label)
matcher = Spectator::Matchers::EmptyMatcher.new
matcher.message(partial).should contain(label)
end
@ -35,7 +35,7 @@ describe Spectator::Matchers::EmptyMatcher do
it "contains the actual label" do
array = %i[a b c]
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, array)
partial = new_partial(array, label)
matcher = Spectator::Matchers::EmptyMatcher.new
matcher.negated_message(partial).should contain(label)
end

View File

@ -7,7 +7,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is true" do
value = "foobar"
last = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_true
end
@ -16,7 +16,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
value = "foobar"
last = "foo"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -27,7 +27,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
value = "foobar"
last = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -37,7 +37,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is true" do
value = "foobar"
last = 'r'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_true
end
@ -46,7 +46,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
value = "foobar"
last = 'b'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -57,7 +57,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
value = "foobar"
last = 'z'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -67,7 +67,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is true" do
value = "FOOBAR"
last = /bar/i
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_true
end
@ -76,7 +76,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
value = "FOOBAR"
last = /foo/i
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -87,7 +87,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
value = "FOOBAR"
last = /baz/i
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -99,7 +99,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is true" do
array = %i[a b c]
last = :c
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_true
end
@ -108,7 +108,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
array = %i[a b c]
last = :b
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -119,7 +119,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
array = %i[a b c]
last = :z
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -128,7 +128,7 @@ describe Spectator::Matchers::EndWithMatcher do
context "against matching element type" do
it "is true" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(Symbol)
matcher.match?(partial).should be_true
end
@ -136,7 +136,7 @@ describe Spectator::Matchers::EndWithMatcher do
context "not at end" do
it "is false" do
array = [1, 2, 3, :a, :b, :c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(Int32)
matcher.match?(partial).should be_false
end
@ -146,7 +146,7 @@ describe Spectator::Matchers::EndWithMatcher do
context "against different element type" do
it "is false" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(Int32)
matcher.match?(partial).should be_false
end
@ -156,7 +156,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
last = /baz/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_true
end
@ -165,7 +165,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
last = /bar/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -176,7 +176,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
last = /qux/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.match?(partial).should be_false
end
@ -189,7 +189,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "mentions #ends_with?" do
value = "foobar"
last = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.message(partial).should contain("#starts_with?")
end
@ -198,14 +198,14 @@ describe Spectator::Matchers::EndWithMatcher do
context "with an Enumerable" do
it "mentions ===" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(array.last)
matcher.message(partial).should contain("===")
end
it "mentions last" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(array.last)
matcher.message(partial).should contain("last")
end
@ -215,7 +215,7 @@ describe Spectator::Matchers::EndWithMatcher do
value = "foobar"
last = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.message(partial).should contain(label)
end
@ -224,7 +224,7 @@ describe Spectator::Matchers::EndWithMatcher do
value = "foobar"
last = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(label, last)
matcher.message(partial).should contain(label)
end
@ -233,7 +233,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "contains stringified form of expected value" do
value = "foobar"
last = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.message(partial).should contain(last)
end
@ -245,7 +245,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "mentions #starts_with?" do
value = "foobar"
last = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.negated_message(partial).should contain("#starts_with?")
end
@ -254,14 +254,14 @@ describe Spectator::Matchers::EndWithMatcher do
context "with an Enumerable" do
it "mentions ===" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(array.last)
matcher.negated_message(partial).should contain("===")
end
it "mentions last" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::EndWithMatcher.new(array.last)
matcher.negated_message(partial).should contain("last")
end
@ -271,7 +271,7 @@ describe Spectator::Matchers::EndWithMatcher do
value = "foobar"
last = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.negated_message(partial).should contain(label)
end
@ -280,7 +280,7 @@ describe Spectator::Matchers::EndWithMatcher do
value = "foobar"
last = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(label, last)
matcher.negated_message(partial).should contain(label)
end
@ -289,7 +289,7 @@ describe Spectator::Matchers::EndWithMatcher do
it "contains stringified form of expected value" do
value = "foobar"
last = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
matcher.negated_message(partial).should contain(last)
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::EqualityMatcher do
describe "#match?" do
it "compares using #==" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(spy)
partial = new_partial(spy)
matcher = Spectator::Matchers::EqualityMatcher.new(42)
matcher.match?(partial).should be_true
spy.eq_call_count.should be > 0
@ -13,7 +13,7 @@ describe Spectator::Matchers::EqualityMatcher do
context "with identical values" do
it "is true" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value)
matcher.match?(partial).should be_true
end
@ -23,7 +23,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "is false" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2)
matcher.match?(partial).should be_false
end
@ -33,7 +33,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "is true" do
# Box is used because it is a reference type and doesn't override the == method.
ref = Box.new([] of Int32)
partial = Spectator::Expectations::ValueExpectationPartial.new(ref)
partial = new_partial(ref)
matcher = Spectator::Matchers::EqualityMatcher.new(ref)
matcher.match?(partial).should be_true
end
@ -44,7 +44,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "is true" do
array1 = [1, 2, 3]
array2 = [1, 2, 3]
partial = Spectator::Expectations::ValueExpectationPartial.new(array1)
partial = new_partial(array1)
matcher = Spectator::Matchers::EqualityMatcher.new(array2)
matcher.match?(partial).should be_true
end
@ -54,7 +54,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "is false" do
array1 = [1, 2, 3]
array2 = [4, 5, 6]
partial = Spectator::Expectations::ValueExpectationPartial.new(array1)
partial = new_partial(array1)
matcher = Spectator::Matchers::EqualityMatcher.new(array2)
matcher.match?(partial).should be_false
end
@ -65,7 +65,7 @@ describe Spectator::Matchers::EqualityMatcher do
describe "#message" do
it "mentions ==" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value)
matcher.message(partial).should contain("==")
end
@ -73,7 +73,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::EqualityMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -81,7 +81,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -90,7 +90,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2)
matcher.message(partial).should contain(value2.to_s)
end
@ -100,7 +100,7 @@ describe Spectator::Matchers::EqualityMatcher do
describe "#negated_message" do
it "mentions ==" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(value)
matcher.negated_message(partial).should contain("==")
end
@ -108,7 +108,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::EqualityMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -116,7 +116,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::EqualityMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -125,7 +125,7 @@ describe Spectator::Matchers::EqualityMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::EqualityMatcher.new(value2)
matcher.negated_message(partial).should contain(value2.to_s)
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
describe "#match?" do
it "compares using #>=" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(spy)
partial = new_partial(spy)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(42)
matcher.match?(partial).should be_true
spy.ge_call_count.should be > 0
@ -14,7 +14,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "is false" do
actual = 42
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(expected)
matcher.match?(partial).should be_false
end
@ -24,7 +24,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "is true" do
actual = 777
expected = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(expected)
matcher.match?(partial).should be_true
end
@ -33,7 +33,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
context "with an equal value" do
it "is true" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value)
matcher.match?(partial).should be_true
end
@ -43,7 +43,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
describe "#message" do
it "mentions >=" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value)
matcher.message(partial).should contain(">=")
end
@ -51,7 +51,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -59,7 +59,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -68,7 +68,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value2)
matcher.message(partial).should contain(value2.to_s)
end
@ -78,7 +78,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
describe "#negated_message" do
it "mentions >=" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value)
matcher.negated_message(partial).should contain(">=")
end
@ -86,7 +86,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -94,7 +94,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -103,7 +103,7 @@ describe Spectator::Matchers::GreaterThanEqualMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::GreaterThanEqualMatcher.new(value2)
matcher.negated_message(partial).should contain(value2.to_s)
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
describe "#match?" do
it "compares using #>" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(spy)
partial = new_partial(spy)
matcher = Spectator::Matchers::GreaterThanMatcher.new(42)
matcher.match?(partial).should be_true
spy.gt_call_count.should be > 0
@ -14,7 +14,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "is false" do
actual = 42
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::GreaterThanMatcher.new(expected)
matcher.match?(partial).should be_false
end
@ -24,7 +24,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "is true" do
actual = 777
expected = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::GreaterThanMatcher.new(expected)
matcher.match?(partial).should be_true
end
@ -33,7 +33,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
context "with an equal value" do
it "is false" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanMatcher.new(value)
matcher.match?(partial).should be_false
end
@ -43,7 +43,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
describe "#message" do
it "mentions >" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanMatcher.new(value)
matcher.message(partial).should contain(">")
end
@ -51,7 +51,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::GreaterThanMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -59,7 +59,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -68,7 +68,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::GreaterThanMatcher.new(value2)
matcher.message(partial).should contain(value2.to_s)
end
@ -78,7 +78,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
describe "#negated_message" do
it "mentions >" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanMatcher.new(value)
matcher.negated_message(partial).should contain(">")
end
@ -86,7 +86,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::GreaterThanMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -94,7 +94,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::GreaterThanMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -103,7 +103,7 @@ describe Spectator::Matchers::GreaterThanMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::GreaterThanMatcher.new(value2)
matcher.negated_message(partial).should contain(value2.to_s)
end

View File

@ -5,7 +5,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "uses ===" do
array = %i[a b c]
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({spy})
matcher.match?(partial).should be_true
spy.case_eq_call_count.should be > 0
@ -16,7 +16,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = %i[a b c]
attributes = {first: :a}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -26,7 +26,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = %i[a b c]
attributes = {first: :z}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -36,7 +36,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = %i[a b c]
attributes = {first: Symbol}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -46,7 +46,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = %i[a b c]
attributes = {first: Int32}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -56,7 +56,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
attributes = {first: /foo/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -66,7 +66,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
attributes = {first: /qux/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -78,7 +78,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = %i[a b c]
attributes = {first: :a, last: :c}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -88,7 +88,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = [:a, 42, "FOO"]
attributes = {first: Symbol, last: /foo/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -98,7 +98,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = [:a, 42, "FOO"]
attributes = {first: Symbol, last: /bar/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -110,7 +110,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = [:a, 42, "FOO"]
attributes = {first: Float32, last: /foo/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -120,7 +120,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = [:a, 42, "FOO"]
attributes = {first: Float32, last: /bar/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -132,7 +132,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = %i[a b c]
attributes = {first: :a, last: :d}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -142,7 +142,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = %i[a b c]
attributes = {first: :d, last: :e}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -152,7 +152,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = [:a, 42, "FOO"]
attributes = {first: Symbol, last: String}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -162,7 +162,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = [:a, 42, "FOO"]
attributes = {first: Symbol, last: Float32}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -172,7 +172,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = [:a, 42, "FOO"]
attributes = {first: Float32, last: Bytes}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -182,7 +182,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
attributes = {first: /foo/i, last: /baz/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -192,7 +192,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
attributes = {first: /foo/i, last: /qux/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -202,7 +202,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is false" do
array = %w[FOO BAR]
attributes = {first: /baz/i, last: /qux/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_false
end
@ -212,7 +212,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "is true" do
array = [:a, 42, "FOO"]
attributes = {first: Symbol, last: /foo/i, size: 3}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.match?(partial).should be_true
end
@ -225,7 +225,7 @@ describe Spectator::Matchers::AttributesMatcher do
value = "foobar"
attributes = {size: 6}
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.message(partial).should contain(label)
end
@ -234,7 +234,7 @@ describe Spectator::Matchers::AttributesMatcher do
value = "foobar"
attributes = {size: 6}
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::AttributesMatcher.new(label, attributes)
matcher.message(partial).should contain(label)
end
@ -243,7 +243,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "contains stringified form of expected value" do
value = "foobar"
attributes = {size: 6}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.message(partial).should contain(attributes.to_s)
end
@ -255,7 +255,7 @@ describe Spectator::Matchers::AttributesMatcher do
value = "foobar"
attributes = {size: 6}
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.negated_message(partial).should contain(label)
end
@ -264,7 +264,7 @@ describe Spectator::Matchers::AttributesMatcher do
value = "foobar"
attributes = {size: 6}
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::AttributesMatcher.new(label, attributes)
matcher.negated_message(partial).should contain(label)
end
@ -273,7 +273,7 @@ describe Spectator::Matchers::AttributesMatcher do
it "contains stringified form of expected value" do
value = "foobar"
attributes = {size: 6}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
matcher.negated_message(partial).should contain(attributes.to_s)
end

View File

@ -7,7 +7,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
it "is true" do
hash = Hash{"foo" => "bar"}
key = "foo"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.match?(partial).should be_true
end
@ -17,7 +17,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
it "is false" do
hash = Hash{"foo" => "bar"}
key = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.match?(partial).should be_false
end
@ -29,7 +29,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
it "is true" do
tuple = {foo: "bar"}
key = :foo
partial = Spectator::Expectations::ValueExpectationPartial.new(tuple)
partial = new_partial(tuple)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.match?(partial).should be_true
end
@ -39,7 +39,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
it "is false" do
tuple = {foo: "bar"}
key = :baz
partial = Spectator::Expectations::ValueExpectationPartial.new(tuple)
partial = new_partial(tuple)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.match?(partial).should be_false
end
@ -52,7 +52,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
tuple = {foo: "bar"}
key = :foo
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, tuple)
partial = new_partial(tuple, label)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.message(partial).should contain(label)
end
@ -61,7 +61,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
tuple = {foo: "bar"}
key = :foo
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(tuple)
partial = new_partial(tuple)
matcher = Spectator::Matchers::HaveKeyMatcher.new(label, key)
matcher.message(partial).should contain(label)
end
@ -70,7 +70,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
it "contains the stringified key" do
tuple = {foo: "bar"}
key = :foo
partial = Spectator::Expectations::ValueExpectationPartial.new(tuple)
partial = new_partial(tuple)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.message(partial).should contain(key.to_s)
end
@ -82,7 +82,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
tuple = {foo: "bar"}
key = :foo
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, tuple)
partial = new_partial(tuple, label)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.negated_message(partial).should contain(label)
end
@ -91,7 +91,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
tuple = {foo: "bar"}
key = :foo
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(tuple)
partial = new_partial(tuple)
matcher = Spectator::Matchers::HaveKeyMatcher.new(label, key)
matcher.negated_message(partial).should contain(label)
end
@ -100,7 +100,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
it "contains the stringified key" do
tuple = {foo: "bar"}
key = :foo
partial = Spectator::Expectations::ValueExpectationPartial.new(tuple)
partial = new_partial(tuple)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
matcher.negated_message(partial).should contain(key.to_s)
end

View File

@ -5,7 +5,7 @@ describe Spectator::Matchers::HaveMatcher do
it "uses ===" do
array = %i[a b c]
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({spy})
matcher.match?(partial).should be_true
spy.case_eq_call_count.should be > 0
@ -17,7 +17,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobarbaz"
search = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -26,7 +26,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobar"
search = "foo"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -36,7 +36,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobar"
search = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -47,7 +47,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobar"
search = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_false
end
@ -57,7 +57,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobar"
search = 'o'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -66,7 +66,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobar"
search = 'f'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -76,7 +76,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobar"
search = 'r'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -87,7 +87,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobar"
search = 'z'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_false
end
@ -99,7 +99,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobarbaz"
search = {"foo", "bar", "baz"}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -109,7 +109,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobarbaz"
search = {"foo", "qux"}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -119,7 +119,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobar"
search = {"baz", "qux"}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -129,7 +129,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobarbaz"
search = {'f', 'b', 'z'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -139,7 +139,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobarbaz"
search = {'f', 'c', 'd'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -149,7 +149,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobarbaz"
search = {'c', 'd', 'e'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -159,7 +159,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
value = "foobarbaz"
search = {"foo", 'z'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -169,7 +169,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobarbaz"
search = {"foo", 'c'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -179,7 +179,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobarbaz"
search = {"qux", 'f'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -189,7 +189,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
value = "foobarbaz"
search = {"qux", 'c'}
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -203,7 +203,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %i[a b c]
search = :b
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -212,7 +212,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %i[a b c]
search = :a
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -222,7 +222,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %i[a b c]
search = :c
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -233,7 +233,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = %i[a b c]
search = :z
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_false
end
@ -242,7 +242,7 @@ describe Spectator::Matchers::HaveMatcher do
context "against a matching type" do
it "is true" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({Symbol})
matcher.match?(partial).should be_true
end
@ -250,7 +250,7 @@ describe Spectator::Matchers::HaveMatcher do
context "at the beginning" do
it "is true" do
array = [:a, 1, 2]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({Symbol})
matcher.match?(partial).should be_true
end
@ -259,7 +259,7 @@ describe Spectator::Matchers::HaveMatcher do
context "at the end" do
it "is true" do
array = [0, 1, :c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({Symbol})
matcher.match?(partial).should be_true
end
@ -269,7 +269,7 @@ describe Spectator::Matchers::HaveMatcher do
context "against a non-matching type" do
it "is false" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({Int32})
matcher.match?(partial).should be_false
end
@ -279,7 +279,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
search = /bar/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -288,7 +288,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
search = /foo/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -298,7 +298,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
search = /baz/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_true
end
@ -309,7 +309,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
search = /qux/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.match?(partial).should be_false
end
@ -321,7 +321,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %i[a b c]
search = {:a, :b}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -331,7 +331,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = [:a, 42, "FOO"]
search = {:a, Int32, /foo/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -341,7 +341,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = [:a, 42, "FOO"]
search = {:a, Int32, /bar/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -353,7 +353,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = [:a, 42, "FOO"]
search = {:a, Float32, /foo/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -363,7 +363,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = [:a, 42, "FOO"]
search = {:a, Float32, /bar/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -375,7 +375,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = %i[a b c]
search = {:a, :d}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -385,7 +385,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = %i[a b c]
search = {:d, :e}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -395,7 +395,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = [:a, 42, "FOO"]
search = {Symbol, String}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -405,7 +405,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = [:a, 42, "FOO"]
search = {Symbol, Float32}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -415,7 +415,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = [:a, 42, "FOO"]
search = {Float32, Bytes}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -425,7 +425,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
search = {/foo/i, /bar/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -435,7 +435,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
search = {/foo/i, /qux/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -445,7 +445,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is false" do
array = %w[FOO BAR]
search = {/baz/i, /qux/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_false
end
@ -455,7 +455,7 @@ describe Spectator::Matchers::HaveMatcher do
it "is true" do
array = [:a, 42, "FOO"]
search = {:a, Int32, /foo/i}
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
matcher.match?(partial).should be_true
end
@ -469,7 +469,7 @@ describe Spectator::Matchers::HaveMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.message(partial).should contain(label)
end
@ -478,7 +478,7 @@ describe Spectator::Matchers::HaveMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(label, {search})
matcher.message(partial).should contain(label)
end
@ -487,7 +487,7 @@ describe Spectator::Matchers::HaveMatcher do
it "contains stringified form of expected value" do
value = "foobar"
search = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.message(partial).should contain(search)
end
@ -499,7 +499,7 @@ describe Spectator::Matchers::HaveMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.negated_message(partial).should contain(label)
end
@ -508,7 +508,7 @@ describe Spectator::Matchers::HaveMatcher do
value = "foobar"
search = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new(label, {search})
matcher.negated_message(partial).should contain(label)
end
@ -517,7 +517,7 @@ describe Spectator::Matchers::HaveMatcher do
it "contains stringified form of expected value" do
value = "foobar"
search = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::HaveMatcher.new({search})
matcher.negated_message(partial).should contain(search)
end

View File

@ -6,7 +6,7 @@ describe Spectator::Matchers::HaveValueMatcher do
it "is true" do
hash = Hash{"foo" => "bar"}
value = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveValueMatcher.new(value)
matcher.match?(partial).should be_true
end
@ -16,7 +16,7 @@ describe Spectator::Matchers::HaveValueMatcher do
it "is false" do
hash = Hash{"foo" => "bar"}
value = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveValueMatcher.new(value)
matcher.match?(partial).should be_false
end
@ -28,7 +28,7 @@ describe Spectator::Matchers::HaveValueMatcher do
hash = Hash{"foo" => "bar"}
value = "bar"
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, hash)
partial = new_partial(hash, label)
matcher = Spectator::Matchers::HaveValueMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -37,7 +37,7 @@ describe Spectator::Matchers::HaveValueMatcher do
hash = Hash{"foo" => "bar"}
value = "bar"
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveValueMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -46,7 +46,7 @@ describe Spectator::Matchers::HaveValueMatcher do
it "contains the stringified key" do
hash = Hash{"foo" => "bar"}
value = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveValueMatcher.new(value)
matcher.message(partial).should contain(value.to_s)
end
@ -58,7 +58,7 @@ describe Spectator::Matchers::HaveValueMatcher do
hash = Hash{"foo" => "bar"}
value = "bar"
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, hash)
partial = new_partial(hash, label)
matcher = Spectator::Matchers::HaveValueMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -67,7 +67,7 @@ describe Spectator::Matchers::HaveValueMatcher do
hash = Hash{"foo" => "bar"}
value = "bar"
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveValueMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -76,7 +76,7 @@ describe Spectator::Matchers::HaveValueMatcher do
it "contains the stringified key" do
hash = Hash{"foo" => "bar"}
value = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(hash)
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveValueMatcher.new(value)
matcher.negated_message(partial).should contain(value.to_s)
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::InequalityMatcher do
describe "#match?" do
it "compares using #!=" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(spy)
partial = new_partial(spy)
matcher = Spectator::Matchers::InequalityMatcher.new(42)
matcher.match?(partial).should be_true
spy.ne_call_count.should be > 0
@ -13,7 +13,7 @@ describe Spectator::Matchers::InequalityMatcher do
context "with identical values" do
it "is false" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::InequalityMatcher.new(value)
matcher.match?(partial).should be_false
end
@ -23,7 +23,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "is true" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::InequalityMatcher.new(value2)
matcher.match?(partial).should be_true
end
@ -33,7 +33,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "is false" do
# Box is used because it is a reference type and doesn't override the == method.
ref = Box.new([] of Int32)
partial = Spectator::Expectations::ValueExpectationPartial.new(ref)
partial = new_partial(ref)
matcher = Spectator::Matchers::InequalityMatcher.new(ref)
matcher.match?(partial).should be_false
end
@ -44,7 +44,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "is false" do
array1 = [1, 2, 3]
array2 = [1, 2, 3]
partial = Spectator::Expectations::ValueExpectationPartial.new(array1)
partial = new_partial(array1)
matcher = Spectator::Matchers::InequalityMatcher.new(array2)
matcher.match?(partial).should be_false
end
@ -54,7 +54,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "is true" do
array1 = [1, 2, 3]
array2 = [4, 5, 6]
partial = Spectator::Expectations::ValueExpectationPartial.new(array1)
partial = new_partial(array1)
matcher = Spectator::Matchers::InequalityMatcher.new(array2)
matcher.match?(partial).should be_true
end
@ -65,7 +65,7 @@ describe Spectator::Matchers::InequalityMatcher do
describe "#message" do
it "mentions !=" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::InequalityMatcher.new(value)
matcher.message(partial).should contain("!=")
end
@ -73,7 +73,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::InequalityMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -81,7 +81,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::InequalityMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -90,7 +90,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::InequalityMatcher.new(value2)
matcher.message(partial).should contain(value2.to_s)
end
@ -100,7 +100,7 @@ describe Spectator::Matchers::InequalityMatcher do
describe "#negated_message" do
it "mentions !=" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::InequalityMatcher.new(value)
matcher.negated_message(partial).should contain("!=")
end
@ -108,7 +108,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::InequalityMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -116,7 +116,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::InequalityMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -125,7 +125,7 @@ describe Spectator::Matchers::InequalityMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::InequalityMatcher.new(value2)
matcher.negated_message(partial).should contain(value2.to_s)
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
describe "#match?" do
it "compares using #<=" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(spy)
partial = new_partial(spy)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(42)
matcher.match?(partial).should be_true
spy.le_call_count.should be > 0
@ -14,7 +14,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "is true" do
actual = 42
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(expected)
matcher.match?(partial).should be_true
end
@ -24,7 +24,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "is false" do
actual = 777
expected = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(expected)
matcher.match?(partial).should be_false
end
@ -33,7 +33,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
context "with an equal value" do
it "is true" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value)
matcher.match?(partial).should be_true
end
@ -43,7 +43,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
describe "#message" do
it "mentions <=" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value)
matcher.message(partial).should contain("<=")
end
@ -51,7 +51,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -59,7 +59,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -68,7 +68,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value2)
matcher.message(partial).should contain(value2.to_s)
end
@ -78,7 +78,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
describe "#negated_message" do
it "mentions <=" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value)
matcher.negated_message(partial).should contain("<=")
end
@ -86,7 +86,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -94,7 +94,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -103,7 +103,7 @@ describe Spectator::Matchers::LessThanEqualMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::LessThanEqualMatcher.new(value2)
matcher.negated_message(partial).should contain(value2.to_s)
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::LessThanMatcher do
describe "#match?" do
it "compares using #<" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(spy)
partial = new_partial(spy)
matcher = Spectator::Matchers::LessThanMatcher.new(42)
matcher.match?(partial).should be_true
spy.lt_call_count.should be > 0
@ -14,7 +14,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "is true" do
actual = 42
expected = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::LessThanMatcher.new(expected)
matcher.match?(partial).should be_true
end
@ -24,7 +24,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "is false" do
actual = 777
expected = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(actual)
partial = new_partial(actual)
matcher = Spectator::Matchers::LessThanMatcher.new(expected)
matcher.match?(partial).should be_false
end
@ -33,7 +33,7 @@ describe Spectator::Matchers::LessThanMatcher do
context "with an equal value" do
it "is false" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanMatcher.new(value)
matcher.match?(partial).should be_false
end
@ -43,7 +43,7 @@ describe Spectator::Matchers::LessThanMatcher do
describe "#message" do
it "mentions <" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanMatcher.new(value)
matcher.message(partial).should contain("<")
end
@ -51,7 +51,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::LessThanMatcher.new(value)
matcher.message(partial).should contain(label)
end
@ -59,7 +59,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanMatcher.new(label, value)
matcher.message(partial).should contain(label)
end
@ -68,7 +68,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::LessThanMatcher.new(value2)
matcher.message(partial).should contain(value2.to_s)
end
@ -78,7 +78,7 @@ describe Spectator::Matchers::LessThanMatcher do
describe "#negated_message" do
it "mentions <" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanMatcher.new(value)
matcher.negated_message(partial).should contain("<")
end
@ -86,7 +86,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::LessThanMatcher.new(value)
matcher.negated_message(partial).should contain(label)
end
@ -94,7 +94,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "contains the expected label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::LessThanMatcher.new(label, value)
matcher.negated_message(partial).should contain(label)
end
@ -103,7 +103,7 @@ describe Spectator::Matchers::LessThanMatcher do
it "contains stringified form of expected value" do
value1 = 42
value2 = 777
partial = Spectator::Expectations::ValueExpectationPartial.new(value1)
partial = new_partial(value1)
matcher = Spectator::Matchers::LessThanMatcher.new(value2)
matcher.negated_message(partial).should contain(value2.to_s)
end

View File

@ -5,7 +5,7 @@ describe Spectator::Matchers::NilMatcher do
context "with nil" do
it "is true" do
value = nil.as(Bool?)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::NilMatcher.new
matcher.match?(partial).should be_true
end
@ -14,7 +14,7 @@ describe Spectator::Matchers::NilMatcher do
context "with not nil" do
it "is false" do
value = true.as(Bool?)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::NilMatcher.new
matcher.match?(partial).should be_false
end
@ -23,7 +23,7 @@ describe Spectator::Matchers::NilMatcher do
describe "#message" do
it "mentions nil" do
partial = Spectator::Expectations::ValueExpectationPartial.new(42)
partial = new_partial(42)
matcher = Spectator::Matchers::NilMatcher.new
matcher.message(partial).should contain("nil")
end
@ -31,7 +31,7 @@ describe Spectator::Matchers::NilMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::NilMatcher.new
matcher.message(partial).should contain(label)
end
@ -39,7 +39,7 @@ describe Spectator::Matchers::NilMatcher do
describe "#negated_message" do
it "mentions nil" do
partial = Spectator::Expectations::ValueExpectationPartial.new(42)
partial = new_partial(42)
matcher = Spectator::Matchers::NilMatcher.new
matcher.negated_message(partial).should contain("nil")
end
@ -47,7 +47,7 @@ describe Spectator::Matchers::NilMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::NilMatcher.new
matcher.negated_message(partial).should contain(label)
end

View File

@ -5,7 +5,7 @@ describe Spectator::Matchers::PredicateMatcher do
context "with a true predicate" do
it "is true" do
value = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::PredicateMatcher(NamedTuple(ascii_only: Nil)).new
matcher.match?(partial).should be_true
end
@ -14,7 +14,7 @@ describe Spectator::Matchers::PredicateMatcher do
context "with a false predicate" do
it "is false" do
value = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::PredicateMatcher(NamedTuple(empty: Nil)).new
matcher.match?(partial).should be_false
end
@ -25,14 +25,14 @@ describe Spectator::Matchers::PredicateMatcher do
it "contains the actual label" do
value = "foobar"
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::PredicateMatcher(NamedTuple(ascii_only: Nil)).new
matcher.message(partial).should contain(label)
end
it "contains stringified form of predicate" do
value = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::PredicateMatcher(NamedTuple(ascii_only: Nil)).new
matcher.message(partial).should contain("ascii_only")
end
@ -42,14 +42,14 @@ describe Spectator::Matchers::PredicateMatcher do
it "contains the actual label" do
value = "foobar"
label = "blah"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::PredicateMatcher(NamedTuple(ascii_only: Nil)).new
matcher.negated_message(partial).should contain(label)
end
it "contains stringified form of predicate" do
value = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::PredicateMatcher(NamedTuple(ascii_only: Nil)).new
matcher.negated_message(partial).should contain("ascii_only")
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::RangeMatcher do
describe "#match?" do
it "compares using #includes?" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(5)
partial = new_partial(5)
matcher = Spectator::Matchers::RangeMatcher.new(spy)
matcher.match?(partial).should be_true
spy.includes_call_count.should be > 0
@ -17,7 +17,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_true
end
@ -27,7 +27,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower - 1
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_false
end
@ -37,7 +37,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = 5
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_true
end
@ -47,7 +47,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_true
end
@ -57,7 +57,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper + 1
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_false
end
@ -69,7 +69,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_true
end
@ -79,7 +79,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower - 1
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_false
end
@ -89,7 +89,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = 5
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_true
end
@ -99,7 +99,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_false
end
@ -109,7 +109,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper + 1
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.match?(partial).should be_false
end
@ -120,7 +120,7 @@ describe Spectator::Matchers::RangeMatcher do
it "is true for an existing item" do
array = %i[a b c]
value = :b
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(array)
matcher.match?(partial).should be_true
end
@ -128,7 +128,7 @@ describe Spectator::Matchers::RangeMatcher do
it "is false for a non-existing item" do
array = %i[a b c]
value = :z
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(array)
matcher.match?(partial).should be_false
end
@ -140,7 +140,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1..10
value = 5
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.message(partial).should contain(label)
end
@ -149,7 +149,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1..10
value = 5
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range)
matcher.message(partial).should contain(label)
end
@ -158,7 +158,7 @@ describe Spectator::Matchers::RangeMatcher do
it "contains stringified form of expected value" do
range = 1..10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.message(partial).should contain(range.to_s)
end
@ -170,7 +170,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1..10
value = 5
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.negated_message(partial).should contain(label)
end
@ -179,7 +179,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1..10
value = 5
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range)
matcher.negated_message(partial).should contain(label)
end
@ -188,7 +188,7 @@ describe Spectator::Matchers::RangeMatcher do
it "contains stringified form of expected value" do
range = 1..10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
matcher.negated_message(partial).should contain(range.to_s)
end
@ -201,7 +201,7 @@ describe Spectator::Matchers::RangeMatcher do
diff = 4
lower = center - diff
value = lower
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.match?(partial).should be_true
end
@ -211,7 +211,7 @@ describe Spectator::Matchers::RangeMatcher do
diff = 4
lower = center - diff
value = lower - 1
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.match?(partial).should be_false
end
@ -220,7 +220,7 @@ describe Spectator::Matchers::RangeMatcher do
center = 5
diff = 4
value = center
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.match?(partial).should be_true
end
@ -230,7 +230,7 @@ describe Spectator::Matchers::RangeMatcher do
diff = 4
upper = center + diff
value = upper
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.match?(partial).should be_true
end
@ -240,7 +240,7 @@ describe Spectator::Matchers::RangeMatcher do
diff = 4
upper = center + diff
value = upper + 1
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.match?(partial).should be_false
end
@ -251,7 +251,7 @@ describe Spectator::Matchers::RangeMatcher do
diff = 4
value = 3
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, diff).of(center)
matcher.message(partial).should contain(label)
end
@ -260,7 +260,7 @@ describe Spectator::Matchers::RangeMatcher do
center = 5
diff = 4
value = 3
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.message(partial).should contain(center.to_s)
end
@ -269,7 +269,7 @@ describe Spectator::Matchers::RangeMatcher do
center = 5
diff = 4
value = 3
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.message(partial).should contain(diff.to_s)
end
@ -281,7 +281,7 @@ describe Spectator::Matchers::RangeMatcher do
diff = 4
value = 3
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, diff).of(center)
matcher.negated_message(partial).should contain(label)
end
@ -290,7 +290,7 @@ describe Spectator::Matchers::RangeMatcher do
center = 5
diff = 4
value = 3
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.negated_message(partial).should contain(center.to_s)
end
@ -299,7 +299,7 @@ describe Spectator::Matchers::RangeMatcher do
center = 5
diff = 4
value = 3
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
matcher.negated_message(partial).should contain(diff.to_s)
end
@ -313,7 +313,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_true
end
@ -323,7 +323,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower - 1
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_false
end
@ -333,7 +333,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = 5
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_true
end
@ -343,7 +343,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_true
end
@ -353,7 +353,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper + 1
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_false
end
@ -362,7 +362,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions inclusive" do
range = 1...10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.message(partial).should contain("inclusive")
end
@ -370,7 +370,7 @@ describe Spectator::Matchers::RangeMatcher do
it "does not mention exclusive" do
range = 1...10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.message(partial).should_not contain("exclusive")
end
@ -379,7 +379,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1...10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
matcher.message(partial).should contain(label)
end
@ -389,7 +389,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions inclusive" do
range = 1...10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.negated_message(partial).should contain("inclusive")
end
@ -397,7 +397,7 @@ describe Spectator::Matchers::RangeMatcher do
it "does not mention exclusive" do
range = 1...10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.negated_message(partial).should_not contain("exclusive")
end
@ -406,7 +406,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1...10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
matcher.negated_message(partial).should contain(label)
end
@ -419,7 +419,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_true
end
@ -429,7 +429,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower - 1
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_false
end
@ -439,7 +439,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = 5
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_true
end
@ -449,7 +449,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_true
end
@ -459,7 +459,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper + 1
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.match?(partial).should be_false
end
@ -468,7 +468,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions inclusive" do
range = 1...10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.message(partial).should contain("inclusive")
end
@ -477,7 +477,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1..10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
matcher.message(partial).should contain(label)
end
@ -487,7 +487,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions inclusive" do
range = 1..10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
matcher.negated_message(partial).should contain("inclusive")
end
@ -496,7 +496,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1...10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).inclusive
matcher.negated_message(partial).should contain(label)
end
@ -511,7 +511,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_true
end
@ -521,7 +521,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower - 1
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_false
end
@ -531,7 +531,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = 5
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_true
end
@ -541,7 +541,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_false
end
@ -551,7 +551,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper + 1
range = Range.new(lower, upper, exclusive: false)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_false
end
@ -560,7 +560,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions exclusive" do
range = 1..10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.message(partial).should contain("exclusive")
end
@ -568,7 +568,7 @@ describe Spectator::Matchers::RangeMatcher do
it "does not mention inclusive" do
range = 1..10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.message(partial).should_not contain("inclusive")
end
@ -577,7 +577,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1..10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
matcher.message(partial).should contain(label)
end
@ -587,7 +587,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions exclusive" do
range = 1..10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.negated_message(partial).should contain("exclusive")
end
@ -595,7 +595,7 @@ describe Spectator::Matchers::RangeMatcher do
it "does not mention inclusive" do
range = 1..10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.negated_message(partial).should_not contain("inclusive")
end
@ -604,7 +604,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1..10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
matcher.negated_message(partial).should contain(label)
end
@ -617,7 +617,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_true
end
@ -627,7 +627,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = lower - 1
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_false
end
@ -637,7 +637,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = 5
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_true
end
@ -647,7 +647,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_false
end
@ -657,7 +657,7 @@ describe Spectator::Matchers::RangeMatcher do
upper = 9
value = upper + 1
range = Range.new(lower, upper, exclusive: true)
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.match?(partial).should be_false
end
@ -666,7 +666,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions exclusive" do
range = 1...10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.message(partial).should contain("exclusive")
end
@ -675,7 +675,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1...10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
matcher.message(partial).should contain(label)
end
@ -685,7 +685,7 @@ describe Spectator::Matchers::RangeMatcher do
it "mentions exclusive" do
range = 1...10
value = 5
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
matcher.negated_message(partial).should contain("exclusive")
end
@ -694,7 +694,7 @@ describe Spectator::Matchers::RangeMatcher do
range = 1...10
value = 5
label = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(label, range).exclusive
matcher.negated_message(partial).should contain(label)
end

View File

@ -4,7 +4,7 @@ describe Spectator::Matchers::RegexMatcher do
describe "#match?" do
it "compares using #=~" do
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(spy)
partial = new_partial(spy)
matcher = Spectator::Matchers::RegexMatcher.new(/foobar/)
matcher.match?(partial).should be_true
spy.match_call_count.should be > 0
@ -14,7 +14,7 @@ describe Spectator::Matchers::RegexMatcher do
it "is true" do
value = "foobar"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.match?(partial).should be_true
end
@ -24,7 +24,7 @@ describe Spectator::Matchers::RegexMatcher do
it "is false" do
value = "foo"
pattern = /bar/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.match?(partial).should be_false
end
@ -35,7 +35,7 @@ describe Spectator::Matchers::RegexMatcher do
it "mentions =~" do
value = "foobar"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.message(partial).should contain("=~")
end
@ -44,7 +44,7 @@ describe Spectator::Matchers::RegexMatcher do
value = "foobar"
label = "different"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.message(partial).should contain(label)
end
@ -53,7 +53,7 @@ describe Spectator::Matchers::RegexMatcher do
value = "foobar"
label = "different"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(label, pattern)
matcher.message(partial).should contain(label)
end
@ -62,7 +62,7 @@ describe Spectator::Matchers::RegexMatcher do
it "contains stringified form of expected value" do
value = "foobar"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.message(partial).should contain(pattern.to_s)
end
@ -73,7 +73,7 @@ describe Spectator::Matchers::RegexMatcher do
it "mentions =~" do
value = "foobar"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.negated_message(partial).should contain("=~")
end
@ -82,7 +82,7 @@ describe Spectator::Matchers::RegexMatcher do
value = "foobar"
label = "different"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.negated_message(partial).should contain(label)
end
@ -91,7 +91,7 @@ describe Spectator::Matchers::RegexMatcher do
value = "foobar"
label = "different"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(label, pattern)
matcher.negated_message(partial).should contain(label)
end
@ -100,7 +100,7 @@ describe Spectator::Matchers::RegexMatcher do
it "contains stringified form of expected value" do
value = "foobar"
pattern = /foo/
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
matcher.negated_message(partial).should contain(pattern.to_s)
end

View File

@ -7,7 +7,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is true" do
value = "foobar"
start = "foo"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_true
end
@ -16,7 +16,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
value = "foobar"
start = "bar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -27,7 +27,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
value = "foobar"
start = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -37,7 +37,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is true" do
value = "foobar"
start = 'f'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_true
end
@ -46,7 +46,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
value = "foobar"
start = 'b'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -57,7 +57,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
value = "foobar"
start = 'z'
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -67,7 +67,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is true" do
value = "FOOBAR"
start = /foo/i
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_true
end
@ -76,7 +76,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
value = "FOOBAR"
start = /bar/i
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -87,7 +87,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
value = "FOOBAR"
start = /baz/i
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -99,7 +99,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is true" do
array = %i[a b c]
start = :a
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_true
end
@ -108,7 +108,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
array = %i[a b c]
start = :b
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -119,7 +119,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
array = %i[a b c]
start = :z
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -128,7 +128,7 @@ describe Spectator::Matchers::StartWithMatcher do
context "against matching element type" do
it "is true" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(Symbol)
matcher.match?(partial).should be_true
end
@ -136,7 +136,7 @@ describe Spectator::Matchers::StartWithMatcher do
context "not at start" do
it "is false" do
array = [1, 2, 3, :a, :b, :c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(Symbol)
matcher.match?(partial).should be_false
end
@ -146,7 +146,7 @@ describe Spectator::Matchers::StartWithMatcher do
context "against different element type" do
it "is false" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(Int32)
matcher.match?(partial).should be_false
end
@ -156,7 +156,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is true" do
array = %w[FOO BAR BAZ]
start = /foo/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_true
end
@ -165,7 +165,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
start = /bar/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -176,7 +176,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "is false" do
array = %w[FOO BAR BAZ]
start = /qux/i
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.match?(partial).should be_false
end
@ -189,7 +189,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "mentions #starts_with?" do
value = "foobar"
start = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.message(partial).should contain("#starts_with?")
end
@ -198,14 +198,14 @@ describe Spectator::Matchers::StartWithMatcher do
context "with an Enumerable" do
it "mentions ===" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(array.first)
matcher.message(partial).should contain("===")
end
it "mentions first" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(array.first)
matcher.message(partial).should contain("first")
end
@ -215,7 +215,7 @@ describe Spectator::Matchers::StartWithMatcher do
value = "foobar"
start = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.message(partial).should contain(label)
end
@ -224,7 +224,7 @@ describe Spectator::Matchers::StartWithMatcher do
value = "foobar"
start = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(label, start)
matcher.message(partial).should contain(label)
end
@ -233,7 +233,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "contains stringified form of expected value" do
value = "foobar"
start = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.message(partial).should contain(start)
end
@ -245,7 +245,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "mentions #starts_with?" do
value = "foobar"
start = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.negated_message(partial).should contain("#starts_with?")
end
@ -254,14 +254,14 @@ describe Spectator::Matchers::StartWithMatcher do
context "with an Enumerable" do
it "mentions ===" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(array.first)
matcher.negated_message(partial).should contain("===")
end
it "mentions first" do
array = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
partial = new_partial(array)
matcher = Spectator::Matchers::StartWithMatcher.new(array.first)
matcher.negated_message(partial).should contain("first")
end
@ -271,7 +271,7 @@ describe Spectator::Matchers::StartWithMatcher do
value = "foobar"
start = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.negated_message(partial).should contain(label)
end
@ -280,7 +280,7 @@ describe Spectator::Matchers::StartWithMatcher do
value = "foobar"
start = "baz"
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(label, start)
matcher.negated_message(partial).should contain(label)
end
@ -289,7 +289,7 @@ describe Spectator::Matchers::StartWithMatcher do
it "contains stringified form of expected value" do
value = "foobar"
start = "baz"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(start)
matcher.negated_message(partial).should contain(start)
end

View File

@ -21,7 +21,7 @@ describe Spectator::Matchers::TruthyMatcher do
context "with a truthy value" do
it "is true" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
matcher.match?(partial).should be_true
end
@ -30,7 +30,7 @@ describe Spectator::Matchers::TruthyMatcher do
context "with false" do
it "is false" do
value = false
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
matcher.match?(partial).should be_false
end
@ -39,7 +39,7 @@ describe Spectator::Matchers::TruthyMatcher do
context "with nil" do
it "is false" do
value = nil
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
matcher.match?(partial).should be_false
end
@ -50,7 +50,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
matcher.message(partial).should contain(label)
end
@ -58,7 +58,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the \"truthy\"" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
matcher.message(partial).should contain("truthy")
end
@ -68,7 +68,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
matcher.negated_message(partial).should contain(label)
end
@ -76,7 +76,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the \"truthy\"" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
matcher.negated_message(partial).should contain("truthy")
end
@ -88,7 +88,7 @@ describe Spectator::Matchers::TruthyMatcher do
context "with a truthy value" do
it "is false" do
value = 42
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
matcher.match?(partial).should be_false
end
@ -97,7 +97,7 @@ describe Spectator::Matchers::TruthyMatcher do
context "with false" do
it "is true" do
value = false
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
matcher.match?(partial).should be_true
end
@ -106,7 +106,7 @@ describe Spectator::Matchers::TruthyMatcher do
context "with nil" do
it "is true" do
value = nil
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
matcher.match?(partial).should be_true
end
@ -117,7 +117,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
matcher.message(partial).should contain(label)
end
@ -125,7 +125,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the \"falsey\"" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
matcher.message(partial).should contain("falsey")
end
@ -135,7 +135,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
matcher.negated_message(partial).should contain(label)
end
@ -143,7 +143,7 @@ describe Spectator::Matchers::TruthyMatcher do
it "contains the \"falsey\"" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
matcher.negated_message(partial).should contain("falsey")
end

View File

@ -5,7 +5,7 @@ describe Spectator::Matchers::TypeMatcher do
context "with the same type" do
it "is true" do
value = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TypeMatcher(String).new
matcher.match?(partial).should be_true
end
@ -14,7 +14,7 @@ describe Spectator::Matchers::TypeMatcher do
context "with a different type" do
it "is false" do
value = "foobar"
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TypeMatcher(Int32).new
matcher.match?(partial).should be_false
end
@ -23,7 +23,7 @@ describe Spectator::Matchers::TypeMatcher do
context "with a parent type" do
it "is true" do
value = IO::Memory.new
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TypeMatcher(IO).new
matcher.match?(partial).should be_true
end
@ -32,7 +32,7 @@ describe Spectator::Matchers::TypeMatcher do
context "with a child type" do
it "is false" do
value = Exception.new("foobar")
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TypeMatcher(ArgumentError).new
matcher.match?(partial).should be_false
end
@ -41,7 +41,7 @@ describe Spectator::Matchers::TypeMatcher do
context "with a mix-in" do
it "is true" do
value = %i[a b c]
partial = Spectator::Expectations::ValueExpectationPartial.new(value)
partial = new_partial(value)
matcher = Spectator::Matchers::TypeMatcher(Enumerable(Symbol)).new
matcher.match?(partial).should be_true
end
@ -52,13 +52,13 @@ describe Spectator::Matchers::TypeMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::TypeMatcher(String).new
matcher.message(partial).should contain(label)
end
it "contains the expected type" do
partial = Spectator::Expectations::ValueExpectationPartial.new(42)
partial = new_partial(42)
matcher = Spectator::Matchers::TypeMatcher(String).new
matcher.message(partial).should contain("String")
end
@ -68,13 +68,13 @@ describe Spectator::Matchers::TypeMatcher do
it "contains the actual label" do
value = 42
label = "everything"
partial = Spectator::Expectations::ValueExpectationPartial.new(label, value)
partial = new_partial(value, label)
matcher = Spectator::Matchers::TypeMatcher(String).new
matcher.negated_message(partial).should contain(label)
end
it "contains the expected type" do
partial = Spectator::Expectations::ValueExpectationPartial.new(42)
partial = new_partial(42)
matcher = Spectator::Matchers::TypeMatcher(String).new
matcher.negated_message(partial).should contain("String")
end