2019-01-25 20:12:34 +00:00
|
|
|
require "../spec_helper"
|
|
|
|
|
|
|
|
describe Spectator::Matchers::RangeMatcher do
|
2019-03-06 22:01:00 +00:00
|
|
|
describe "#match" do
|
2019-01-25 20:12:34 +00:00
|
|
|
it "compares using #includes?" do
|
|
|
|
spy = SpySUT.new
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(5)
|
2019-01-25 20:12:34 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(spy)
|
2019-03-06 22:01:00 +00:00
|
|
|
matcher.match(partial)
|
2019-01-25 20:12:34 +00:00
|
|
|
spy.includes_call_count.should be > 0
|
|
|
|
end
|
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
context "returned MatchData" do
|
|
|
|
describe "#matched?" do
|
|
|
|
context "given a Range" do
|
|
|
|
context "inclusive" do
|
|
|
|
it "is true for lower-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for lower-bound minus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower - 1
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for mid-range" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = 5
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for upper-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound plus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper + 1
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "exclusive" do
|
|
|
|
it "is true for lower-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for lower-bound minus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower - 1
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for mid-range" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = 5
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound plus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper + 1
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
|
|
|
end
|
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
context "given an Enumerable" do
|
|
|
|
it "is true for an existing item" do
|
|
|
|
array = %i[a b c]
|
|
|
|
value = :b
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(array)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for a non-existing item" do
|
|
|
|
array = %i[a b c]
|
|
|
|
value = :z
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(array)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
describe "#values" do
|
|
|
|
context "given a Range" do
|
|
|
|
context "lower" do
|
|
|
|
it "is #begin from the expected range" do
|
|
|
|
range = Range.new(3, 9)
|
|
|
|
partial = new_partial(5)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :lower)[:value].should eq(range.begin)
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is prefixed with >=" do
|
|
|
|
range = Range.new(3, 9)
|
|
|
|
partial = new_partial(5)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :lower)[:to_s].should start_with(">=")
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "upper" do
|
|
|
|
it "is #end from the expected range" do
|
|
|
|
range = Range.new(3, 9)
|
|
|
|
partial = new_partial(5)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :upper)[:value].should eq(range.end)
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context "when inclusive" do
|
|
|
|
it "is prefixed with <=" do
|
|
|
|
range = Range.new(3, 9, exclusive: false)
|
|
|
|
partial = new_partial(5)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :upper)[:to_s].should start_with("<=")
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when exclusive" do
|
|
|
|
it "is prefixed with <" do
|
|
|
|
range = Range.new(3, 9, exclusive: false)
|
|
|
|
partial = new_partial(5)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :upper)[:to_s].should start_with("<")
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "actual" do
|
|
|
|
it "is the actual value" do
|
|
|
|
value = 5
|
|
|
|
range = Range.new(3, 9)
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :actual)[:value].should eq(value)
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
context "given an Enumerable" do
|
|
|
|
context "set" do
|
|
|
|
it "is the expected value" do
|
|
|
|
array = %i[a b c]
|
|
|
|
value = :z
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(array)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :set)[:value].should eq(array)
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "actual" do
|
|
|
|
it "is the actual value" do
|
|
|
|
array = %i[a b c]
|
|
|
|
value = :z
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(array)
|
|
|
|
match_data = matcher.match(partial)
|
2019-03-22 17:53:20 +00:00
|
|
|
match_data_value_sans_prefix(match_data.values, :actual)[:value].should eq(value)
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
describe "#message" do
|
|
|
|
it "contains the actual label" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
label = "everything"
|
|
|
|
partial = new_partial(value, label)
|
2019-01-25 20:12:34 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(label)
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
it "contains the expected label" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
label = "everything"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-03-06 22:01:00 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(label)
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
context "when expected label is omitted" do
|
|
|
|
it "contains stringified form of expected value" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(range.to_s)
|
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
2019-03-06 22:01:00 +00:00
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
describe "#negated_message" do
|
|
|
|
it "contains the actual label" do
|
|
|
|
range = 1..10
|
2019-01-25 20:12:34 +00:00
|
|
|
value = 5
|
2019-03-06 22:01:00 +00:00
|
|
|
label = "everything"
|
|
|
|
partial = new_partial(value, label)
|
2019-01-25 20:12:34 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(label)
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
it "contains the expected label" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
label = "everything"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-03-06 22:01:00 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(label)
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
|
2019-03-06 22:01:00 +00:00
|
|
|
context "when expected label is omitted" do
|
|
|
|
it "contains stringified form of expected value" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
partial = new_partial(value)
|
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range)
|
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(range.to_s)
|
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#of" do
|
|
|
|
it "is true for lower-bound" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
lower = center - diff
|
|
|
|
value = lower
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for lower-bound minus 1" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
lower = center - diff
|
|
|
|
value = lower - 1
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for mid-range" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
value = center
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for upper-bound" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
upper = center + diff
|
|
|
|
value = upper
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound plus 1" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
upper = center + diff
|
|
|
|
value = upper + 1
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#message" do
|
|
|
|
it "contains the original label" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
value = 3
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff, label).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the center" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
value = 3
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(center.to_s)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the diff" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
value = 3
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(diff.to_s)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#negated_message" do
|
|
|
|
it "contains the original label" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
value = 3
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff, label).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the center" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
value = 3
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(center.to_s)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the diff" do
|
|
|
|
center = 5
|
|
|
|
diff = 4
|
|
|
|
value = 3
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(diff).of(center)
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(diff.to_s)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#inclusive" do
|
|
|
|
context "initially exclusive" do
|
|
|
|
it "is true for lower-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for lower-bound minus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower - 1
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for mid-range" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = 5
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for upper-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound plus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper + 1
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#message" do
|
|
|
|
it "mentions inclusive" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain("inclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "does not mention exclusive" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should_not contain("exclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#negated_message" do
|
|
|
|
it "mentions inclusive" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain("inclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "does not mention exclusive" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should_not contain("exclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "initially inclusive" do
|
|
|
|
it "is true for lower-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for lower-bound minus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower - 1
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for mid-range" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = 5
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for upper-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound plus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper + 1
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#message" do
|
|
|
|
it "mentions inclusive" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain("inclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#negated_message" do
|
|
|
|
it "mentions inclusive" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain("inclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).inclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#exclusive" do
|
|
|
|
context "initially inclusive" do
|
|
|
|
it "is true for lower-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for lower-bound minus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower - 1
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for mid-range" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = 5
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound plus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper + 1
|
|
|
|
range = Range.new(lower, upper, exclusive: false)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#message" do
|
|
|
|
it "mentions exclusive" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain("exclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "does not mention inclusive" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should_not contain("inclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#negated_message" do
|
|
|
|
it "mentions exclusive" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain("exclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "does not mention inclusive" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should_not contain("inclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1..10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "initially exclusive" do
|
|
|
|
it "is true for lower-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for lower-bound minus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = lower - 1
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is true for mid-range" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = 5
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_true
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is false for upper-bound plus 1" do
|
|
|
|
lower = 3
|
|
|
|
upper = 9
|
|
|
|
value = upper + 1
|
|
|
|
range = Range.new(lower, upper, exclusive: true)
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.matched?.should be_false
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#message" do
|
|
|
|
it "mentions exclusive" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain("exclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#negated_message" do
|
|
|
|
it "mentions exclusive" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-01-25 20:52:41 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain("exclusive")
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "contains the original label" do
|
|
|
|
range = 1...10
|
|
|
|
value = 5
|
|
|
|
label = "foobar"
|
2019-02-15 00:04:59 +00:00
|
|
|
partial = new_partial(value)
|
2019-02-28 22:17:12 +00:00
|
|
|
matcher = Spectator::Matchers::RangeMatcher.new(range, label).exclusive
|
2019-03-06 22:01:00 +00:00
|
|
|
match_data = matcher.match(partial)
|
|
|
|
match_data.negated_message.should contain(label)
|
2019-01-25 20:52:41 +00:00
|
|
|
end
|
2019-01-25 20:12:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|