Sha256: 3b9fd3a9225aba36b101a6d7a6aa7a4f96fd7649fc31e2df4a04f027f706dfcd
Contents?: true
Size: 803 Bytes
Versions: 1
Compression:
Stored size: 803 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 Dry::Types::ConstraintError, /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 Dry::Types::ConstraintError, /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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-3.0.2 | spec/type_argument_spec.rb |