Sha256: 3cfb68b1a2a90974b41d956397892255862cda1292402ae88442b4b1564667cf
Contents?: true
Size: 774 Bytes
Versions: 18
Compression:
Stored size: 774 Bytes
Contents
require "dry-types" describe "type argument" do before do class Test::Foo extend Dry::Initializer::Mixin 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
18 entries across 18 versions & 1 rubygems