Sha256: 7cbe55472583394e7b5e516a71f82fcffcc1a135c00f4342b3de2f431ace0681
Contents?: true
Size: 594 Bytes
Versions: 6
Compression:
Stored size: 594 Bytes
Contents
require "dry-types" describe "Dry type constraint" do before do module Test::Types include Dry::Types.module end class Test::Foo extend Dry::Initializer::Mixin param :foo, type: Test::Types::Strict::String end end context "in case of mismatch" do subject { Test::Foo.new 1 } it "raises TypeError" do expect { subject }.to raise_error TypeError, /1/ 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 end
Version data entries
6 entries across 6 versions & 1 rubygems