From dbcf9ec57dc960f7b6fadbcc12580ec81d72df72 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Tue, 23 Oct 2018 10:49:52 -0600 Subject: [PATCH] Add spec for TypedValueWrapper --- spec/internals/typed_value_wrapper_spec.cr | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 spec/internals/typed_value_wrapper_spec.cr diff --git a/spec/internals/typed_value_wrapper_spec.cr b/spec/internals/typed_value_wrapper_spec.cr new file mode 100644 index 0000000..ec997b1 --- /dev/null +++ b/spec/internals/typed_value_wrapper_spec.cr @@ -0,0 +1,18 @@ +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