mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Support variables and methods for type matcher (be_a).
Addresses https://github.com/icy-arctic-fox/spectator/issues/25
This commit is contained in:
parent
2ec6a31f34
commit
93e270f87a
3 changed files with 32 additions and 1 deletions
26
spec/matchers/type_matcher_spec.cr
Normal file
26
spec/matchers/type_matcher_spec.cr
Normal file
|
@ -0,0 +1,26 @@
|
|||
require "../spec_helper"
|
||||
|
||||
Spectator.describe Spectator::Matchers::TypeMatcher do
|
||||
context String do # Sets `described_class` to String
|
||||
def other_type
|
||||
Int32
|
||||
end
|
||||
|
||||
describe "#|" do
|
||||
it "works on sets" do
|
||||
super_set = (described_class | other_type)
|
||||
|
||||
expect(42).to be_kind_of(super_set)
|
||||
expect("foo").to be_a(super_set)
|
||||
end
|
||||
end
|
||||
|
||||
it "works on described_class" do
|
||||
expect("foo").to be_a_kind_of(described_class)
|
||||
end
|
||||
|
||||
it "works on plain types" do
|
||||
expect(42).to be_a(Int32)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue