Sha256: a3997be8493ac720943b3b56789c4993c880616994c5a66555462211a2aab461

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

describe "PORO type" 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

2 entries across 2 versions & 1 rubygems

Version Path
dry-initializer-0.1.1 spec/dry/poro_type_spec.rb
dry-initializer-0.1.0 spec/dry/poro_type_spec.rb