Sha256: e32a0753f091f2768767c09c2476e80719b2049b15f884d981c35ac953853066
Contents?: true
Size: 740 Bytes
Versions: 1
Compression:
Stored size: 740 Bytes
Contents
describe Dry::Initializer, '.dry_initializer.public_attributes' do subject { instance.class.dry_initializer.public_attributes(instance) } context 'when class has params' do before do class Test::Foo extend Dry::Initializer param :foo, proc(&:to_s), desc: 'a weird parameter' option :moo, optional: true option :bar, default: proc { 1 }, reader: false option :baz, optional: true, reader: :protected option :qux, proc(&:to_s), as: :quxx, reader: :private end end let(:instance) { Test::Foo.new(:FOO, bar: :BAR, baz: :BAZ, qux: :QUX) } it 'collects public options only' do expect(subject).to eq({ foo: 'FOO', moo: nil }) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-3.0.3 | spec/public_attributes_utility_spec.rb |