Fix tests to account for negation wrappers

This commit is contained in:
Michael Miller 2019-03-07 16:12:23 -07:00
parent 37f2ce99a3
commit 0ca0ba0a55
19 changed files with 53 additions and 45 deletions

View file

@ -274,9 +274,9 @@ describe Spectator::Matchers::AttributesMatcher do
matcher = Spectator::Matchers::AttributesMatcher.new(attributes)
match_data = matcher.match(partial)
values = match_data.values
values[:"expected first"].should eq(attributes[:first])
values[:"expected last"].should eq(attributes[:last])
values[:"expected size"].should eq(attributes[:size])
values[:"expected first"].value.should eq(attributes[:first])
values[:"expected last"].value.should eq(attributes[:last])
values[:"expected size"].value.should eq(attributes[:size])
end
it "has the actual values" do

View file

@ -99,7 +99,7 @@ describe Spectator::Matchers::CaseMatcher do
partial = new_partial(actual)
matcher = Spectator::Matchers::CaseMatcher.new(expected)
match_data = matcher.match(partial)
match_data.values[:expected].should eq(expected)
match_data.values[:expected].value.should eq(expected)
end
end

View file

@ -300,7 +300,7 @@ describe Spectator::Matchers::ContainMatcher do
partial = new_partial(array)
matcher = Spectator::Matchers::ContainMatcher.new(search)
match_data = matcher.match(partial)
match_data.values[:subset].should eq(search)
match_data.values[:subset].value.should eq(search)
end
end

View file

@ -32,7 +32,7 @@ describe Spectator::Matchers::EmptyMatcher do
partial = new_partial(array)
matcher = Spectator::Matchers::EmptyMatcher.new
match_data = matcher.match(partial)
match_data.values[:expected].size.should eq(0)
match_data.values[:expected].value.size.should eq(0)
end
end

View file

@ -213,7 +213,7 @@ describe Spectator::Matchers::EndWithMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::EndWithMatcher.new(last)
match_data = matcher.match(partial)
match_data.values[:expected].should eq(last)
match_data.values[:expected].value.should eq(last)
end
end

View file

@ -76,7 +76,7 @@ describe Spectator::Matchers::EqualityMatcher do
partial = new_partial(actual)
matcher = Spectator::Matchers::EqualityMatcher.new(expected)
match_data = matcher.match(partial)
match_data.values[:expected].should eq(expected)
match_data.values[:expected].value.should eq(expected)
end
end

View file

@ -67,7 +67,7 @@ describe Spectator::Matchers::HaveKeyMatcher do
partial = new_partial(tuple)
matcher = Spectator::Matchers::HaveKeyMatcher.new(key)
match_data = matcher.match(partial)
match_data.values[:key].should eq(key)
match_data.values[:key].value.should eq(key)
end
end

View file

@ -518,7 +518,7 @@ describe Spectator::Matchers::HaveMatcher do
partial = new_partial(array)
matcher = Spectator::Matchers::HaveMatcher.new(search)
match_data = matcher.match(partial)
match_data.values[:subset].should eq(search)
match_data.values[:subset].value.should eq(search)
end
end

View file

@ -41,7 +41,7 @@ describe Spectator::Matchers::HaveValueMatcher do
partial = new_partial(hash)
matcher = Spectator::Matchers::HaveValueMatcher.new(value)
match_data = matcher.match(partial)
match_data.values[:value].should eq(value)
match_data.values[:value].value.should eq(value)
end
end

View file

@ -31,7 +31,7 @@ describe Spectator::Matchers::NilMatcher do
partial = new_partial(42)
matcher = Spectator::Matchers::NilMatcher.new
match_data = matcher.match(partial)
match_data.values[:expected].should eq(nil)
match_data.values[:expected].value.should eq(nil)
end
end

View file

@ -157,7 +157,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(5)
matcher = Spectator::Matchers::RangeMatcher.new(range)
match_data = matcher.match(partial)
match_data_prefix(match_data, :lower, Int32)[:value].should eq(range.begin)
match_data_prefix(match_data, :lower)[:value].should eq(range.begin)
end
it "is prefixed with >=" do
@ -165,7 +165,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(5)
matcher = Spectator::Matchers::RangeMatcher.new(range)
match_data = matcher.match(partial)
match_data_prefix(match_data, :lower, Int32)[:to_s].should start_with(">=")
match_data_prefix(match_data, :lower)[:to_s].should start_with(">=")
end
end
@ -175,7 +175,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(5)
matcher = Spectator::Matchers::RangeMatcher.new(range)
match_data = matcher.match(partial)
match_data_prefix(match_data, :upper, Int32)[:value].should eq(range.end)
match_data_prefix(match_data, :upper)[:value].should eq(range.end)
end
context "when inclusive" do
@ -184,7 +184,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(5)
matcher = Spectator::Matchers::RangeMatcher.new(range)
match_data = matcher.match(partial)
match_data_prefix(match_data, :upper, Int32)[:to_s].should start_with("<=")
match_data_prefix(match_data, :upper)[:to_s].should start_with("<=")
end
end
@ -194,7 +194,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(5)
matcher = Spectator::Matchers::RangeMatcher.new(range)
match_data = matcher.match(partial)
match_data_prefix(match_data, :upper, Int32)[:to_s].should start_with("<")
match_data_prefix(match_data, :upper)[:to_s].should start_with("<")
end
end
end
@ -206,7 +206,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(range)
match_data = matcher.match(partial)
match_data_value(match_data, :actual, Int32).should eq(value)
match_data_value(match_data, :actual).should eq(value)
end
end
end
@ -219,7 +219,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(array)
match_data = matcher.match(partial)
match_data_value(match_data, :set, typeof(array)).should eq(array)
match_data_prefix(match_data, :set)[:value].should eq(array)
end
end
@ -230,7 +230,7 @@ describe Spectator::Matchers::RangeMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::RangeMatcher.new(array)
match_data = matcher.match(partial)
match_data_value(match_data, :actual, typeof(value)).should eq(value)
match_data_value(match_data, :actual).should eq(value)
end
end
end

View file

@ -43,7 +43,7 @@ describe Spectator::Matchers::RegexMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::RegexMatcher.new(pattern)
match_data = matcher.match(partial)
match_data.values[:expected].should eq(pattern)
match_data.values[:expected].value.should eq(pattern)
end
end

View file

@ -213,7 +213,7 @@ describe Spectator::Matchers::StartWithMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::StartWithMatcher.new(first)
match_data = matcher.match(partial)
match_data.values[:expected].should eq(first)
match_data.values[:expected].value.should eq(first)
end
end

View file

@ -58,7 +58,7 @@ describe Spectator::Matchers::TruthyMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
match_data = matcher.match(partial)
match_data.values[:expected].should match(/false or nil/i)
match_data.values[:expected].to_s.should match(/false or nil/i)
end
it "is prefixed with \"Not\"" do
@ -66,7 +66,7 @@ describe Spectator::Matchers::TruthyMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(true)
match_data = matcher.match(partial)
match_data.values[:expected].should start_with(/not/i)
match_data.values[:expected].to_s.should start_with(/not/i)
end
end
@ -194,7 +194,7 @@ describe Spectator::Matchers::TruthyMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
match_data = matcher.match(partial)
match_data.values[:expected].should match(/false or nil/i)
match_data.values[:expected].to_s.should match(/false or nil/i)
end
it "is not prefixed with \"Not\"" do
@ -202,7 +202,7 @@ describe Spectator::Matchers::TruthyMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::TruthyMatcher.new(false)
match_data = matcher.match(partial)
match_data.values[:expected].should_not start_with(/not/i)
match_data.values[:expected].to_s.should_not start_with(/not/i)
end
end

View file

@ -62,7 +62,7 @@ describe Spectator::Matchers::TypeMatcher do
partial = new_partial(value)
matcher = Spectator::Matchers::TypeMatcher(String).new
match_data = matcher.match(partial)
match_data.values[:expected].should eq(String)
match_data.values[:expected].value.should eq(String)
end
end