Sha256: c5a31af5633f07a0d3ed7eafa7d21a01ee4745eb139fc25ff50de8ddf0c396e1
Contents?: true
Size: 712 Bytes
Versions: 1
Compression:
Stored size: 712 Bytes
Contents
describe 'custom dispatchers' do subject { Test::Foo.new '123' } before do dispatcher = ->(op) { op[:integer] ? op.merge(type: proc(&:to_i)) : op } Dry::Initializer::Dispatchers << dispatcher end context 'with extend syntax' do before do class Test::Foo extend Dry::Initializer param :id, integer: true end end it 'adds syntax sugar' do expect(subject.id).to eq 123 end end context 'with include syntax' do before do class Test::Foo include Dry::Initializer.define -> do param :id, integer: true end end end it 'adds syntax sugar' do expect(subject.id).to eq 123 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-3.0.3 | spec/custom_dispatchers_spec.rb |