Sha256: ccbaabf2c7394e3f00793d4bc3439b85a383449cf49ea8e27713b2728078d87d

Contents?: true

Size: 493 Bytes

Versions: 1

Compression:

Stored size: 493 Bytes

Contents

describe "object type constraint" do
  before do
    class Test::Foo
      extend Dry::Initializer::Mixin

      param :foo, type: /bar/
    end
  end

  context "in case of mismatch" do
    subject { Test::Foo.new 'baz' }

    it "raises TypeError" do
      expect { subject }.to raise_error TypeError
    end
  end

  context "in case of match" do
    subject { Test::Foo.new 'barbar' }

    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.2.0 spec/dry/object_type_constraint_spec.rb