Sha256: 62849de5c48162a012147c727a222e8db5da67b14be6d241c8fc5d2a0d95cebc
Contents?: true
Size: 693 Bytes
Versions: 6
Compression:
Stored size: 693 Bytes
Contents
describe "plain type constraint" do before do class Test::Foo extend Dry::Initializer::Mixin param :foo, type: String end end context "in case of mismatch" do subject { Test::Foo.new :foo } it "raises TypeError" do expect { subject }.to raise_error TypeError, /:foo/ end end context "in case of match" do subject { Test::Foo.new "foo" } it "completes the initialization" do expect { subject }.not_to raise_error end end context "in case of soft match" do subject { Test::Foo.new Class.new(String).new "foo" } it "completes the initialization" do expect { subject }.not_to raise_error end end end
Version data entries
6 entries across 6 versions & 1 rubygems