Test values returned by match data

This commit is contained in:
Michael Miller 2019-03-03 12:13:35 -07:00
parent bb3f2d5338
commit ec06daaf35
2 changed files with 43 additions and 0 deletions

View file

@ -69,6 +69,28 @@ describe Spectator::Matchers::EqualityMatcher do
end
end
describe "#values" do
context "expected" do
it "is the expected value" do
expected, actual = 42, 777
partial = new_partial(actual)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
match_data = matcher.match(partial)
match_data.values[:expected].should eq(expected)
end
end
context "actual" do
it "is the actual value" do
expected, actual = 42, 777
partial = new_partial(actual)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
match_data = matcher.match(partial)
match_data.values[:actual].should eq(actual)
end
end
end
describe "#message" do
it "mentions ==" do
value = 42

View file

@ -25,6 +25,27 @@ describe Spectator::Matchers::NilMatcher do
end
end
describe "#values" do
context "expected" do
it "is nil" do
partial = new_partial(42)
matcher = Spectator::Matchers::NilMatcher.new
match_data = matcher.match(partial)
match_data.values[:expected].should eq(nil)
end
end
context "actual" do
it "is the actual value" do
value = 42
partial = new_partial(value)
matcher = Spectator::Matchers::NilMatcher.new
match_data = matcher.match(partial)
match_data.values[:actual].should eq(value)
end
end
end
describe "#message" do
it "mentions nil" do
partial = new_partial(42)