Sha256: 0a7f1d38498f0802ef87d56f3ac5e6d43190c6c613cdc151049266cc8c809bd6
Contents?: true
Size: 803 Bytes
Versions: 1
Compression:
Stored size: 803 Bytes
Contents
require 'dry-types' describe 'type argument' do before do class Test::Foo extend Dry::Initializer param :foo, Dry::Types['strict.string'] option :bar, Dry::Types['strict.string'] end end context 'in case of param mismatch' do subject { Test::Foo.new 1, bar: '2' } it 'raises TypeError' do expect { subject }.to raise_error Dry::Types::ConstraintError, /1/ end end context 'in case of option mismatch' do subject { Test::Foo.new '1', bar: 2 } it 'raises TypeError' do expect { subject }.to raise_error Dry::Types::ConstraintError, /2/ end end context 'in case of match' do subject { Test::Foo.new '1', bar: '2' } 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-3.0.3 | spec/type_argument_spec.rb |