Sha256: e44cb3eea58790799b87b4ea3d50edfa87a2d6e0b1d78d7776988142d2f08366

Contents?: true

Size: 493 Bytes

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
dry-initializer-0.3.3 spec/dry/object_type_constraint_spec.rb
dry-initializer-0.3.2 spec/dry/object_type_constraint_spec.rb
dry-initializer-0.3.1 spec/dry/object_type_constraint_spec.rb
dry-initializer-0.3.0 spec/dry/object_type_constraint_spec.rb
dry-initializer-0.2.1 spec/dry/object_type_constraint_spec.rb