Use spy to test that matchers use === operator

This commit is contained in:
Michael Miller 2019-02-04 16:26:53 -07:00
parent e42e5b30bb
commit 71427e4f6b
2 changed files with 18 additions and 0 deletions

View file

@ -2,6 +2,15 @@ require "../spec_helper"
describe Spectator::Matchers::AttributesMatcher do
describe "#match?" do
it "uses ===" do
array = %i[a b c]
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
matcher = Spectator::Matchers::HaveMatcher.new({spy})
matcher.match?(partial).should be_true
spy.case_eq_call_count.should be > 0
end
context "one argument" do
context "against an equal value" do
it "is true" do

View file

@ -2,6 +2,15 @@ require "../spec_helper"
describe Spectator::Matchers::HaveMatcher do
describe "#match?" do
it "uses ===" do
array = %i[a b c]
spy = SpySUT.new
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
matcher = Spectator::Matchers::HaveMatcher.new({spy})
matcher.match?(partial).should be_true
spy.case_eq_call_count.should be > 0
end
context "with a String" do
context "one argument" do
context "against a matching string" do