mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add spec for empty matcher
Mark question matchers as done (for now). More may be added later if they're common.
This commit is contained in:
parent
5231f0fd39
commit
651127f2d4
2 changed files with 44 additions and 1 deletions
43
spec/matchers/empty_matcher_spec.cr
Normal file
43
spec/matchers/empty_matcher_spec.cr
Normal file
|
@ -0,0 +1,43 @@
|
|||
require "../spec_helper"
|
||||
|
||||
describe Spectator::Matchers::EmptyMatcher do
|
||||
describe "#match?" do
|
||||
context "with an empty set" do
|
||||
it "is true" do
|
||||
array = [] of Symbol
|
||||
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
|
||||
matcher = Spectator::Matchers::EmptyMatcher.new
|
||||
matcher.match?(partial).should be_true
|
||||
end
|
||||
end
|
||||
|
||||
context "with a filled set" do
|
||||
it "is false" do
|
||||
array = %i[a b c]
|
||||
partial = Spectator::Expectations::ValueExpectationPartial.new(array)
|
||||
matcher = Spectator::Matchers::EmptyMatcher.new
|
||||
matcher.match?(partial).should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#message" do
|
||||
it "contains the actual label" do
|
||||
array = %i[a b c]
|
||||
label = "everything"
|
||||
partial = Spectator::Expectations::ValueExpectationPartial.new(label, array)
|
||||
matcher = Spectator::Matchers::EmptyMatcher.new
|
||||
matcher.message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#negated_message" do
|
||||
it "contains the actual label" do
|
||||
array = %i[a b c]
|
||||
label = "everything"
|
||||
partial = Spectator::Expectations::ValueExpectationPartial.new(label, array)
|
||||
matcher = Spectator::Matchers::EmptyMatcher.new
|
||||
matcher.negated_message(partial).should contain(label)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue