shard-spectator/spec/internals/typed_value_wrapper_spec.cr

19 lines
557 B
Crystal
Raw Normal View History

2018-10-23 16:49:52 +00:00
require "../spec_helper"
describe Spectator::Internals::TypedValueWrapper do
describe "#value" do
it "returns the expected value" do
value = 12345
wrapper = Spectator::Internals::TypedValueWrapper.new(value)
wrapper.value.should eq(value)
end
end
it "can be cast for storage" do
value = 12345
wrapper = Spectator::Internals::TypedValueWrapper.new(value).as(Spectator::Internals::ValueWrapper)
typed = wrapper.as(Spectator::Internals::TypedValueWrapper(typeof(value)))
typed.value.should eq(value)
end
end