Sha256: cf97449a80aa5d08acd581ca53f0eed0536e6fa9bfa5ce635633c41cbbebfd7a
Contents?: true
Size: 463 Bytes
Versions: 16
Compression:
Stored size: 463 Bytes
Contents
require "strong_json" describe StrongJSON::Type::Optional, "#coerce" do context "optional(:number)" do let (:type) { StrongJSON::Type::Optional.new(StrongJSON::Type::Base.new(:number)) } it "accepts nil" do expect(type.coerce(nil)).to eq(nil) end it "accepts number" do expect(type.coerce(3)).to eq(3) end it "rejects string" do expect { type.coerce("a") }.to raise_error(StrongJSON::Type::Error) end end end
Version data entries
16 entries across 16 versions & 1 rubygems