Sha256: 76f99b99153172437fe567e54e2009029aff21d8c1090388931d492b80233de8
Contents?: true
Size: 767 Bytes
Versions: 8
Compression:
Stored size: 767 Bytes
Contents
require "dry-types" describe "type argument" do before do class Test::Foo extend Dry::Initializer param :foo, Dry::Types["strict.string"] option :bar, Dry::Types["strict.string"] end end context "in case of param mismatch" do subject { Test::Foo.new 1, bar: "2" } it "raises TypeError" do expect { subject }.to raise_error TypeError, /1/ end end context "in case of option mismatch" do subject { Test::Foo.new "1", bar: 2 } it "raises TypeError" do expect { subject }.to raise_error TypeError, /2/ end end context "in case of match" do subject { Test::Foo.new "1", bar: "2" } it "completes the initialization" do expect { subject }.not_to raise_error end end end
Version data entries
8 entries across 8 versions & 1 rubygems