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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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