Sha256: e0c7294ee62dba2e81aa9fc6cb7ca60eb6ff47966c45edd18a6ebbb045b367a4

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

describe "PORO type" do
  before do
    class Test::Foo
      extend Dry::Initializer

      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

1 entries across 1 versions & 1 rubygems

Version Path
dry-initializer-0.0.1 spec/dry/poro_type_spec.rb