mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add specs for value types
This commit is contained in:
parent
7d5c9edab7
commit
4af23751bc
2 changed files with 33 additions and 0 deletions
18
spec/spectator/wrapper_spec.cr
Normal file
18
spec/spectator/wrapper_spec.cr
Normal file
|
@ -0,0 +1,18 @@
|
|||
require "../spec_helper"
|
||||
|
||||
Spectator.describe Spectator::Wrapper do
|
||||
it "stores a value" do
|
||||
wrapper = described_class.new(42)
|
||||
expect(wrapper.get(Int32)).to eq(42)
|
||||
end
|
||||
|
||||
it "retrieves a value using the block trick" do
|
||||
wrapper = described_class.new(Int32)
|
||||
expect(wrapper.get { Int32 }).to eq(Int32)
|
||||
end
|
||||
|
||||
it "raises on invalid cast" do
|
||||
wrapper = described_class.new(42)
|
||||
expect { wrapper.get(String) }.to raise_error(TypeCastError)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue