Sha256: 7265a8fd15747ea78c66d6b51c7b54a2ea2d0b7fd34716dc2d049f646053bb5d
Contents?: true
Size: 713 Bytes
Versions: 2
Compression:
Stored size: 713 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) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-2.1.0 | spec/public_attributes_utility_spec.rb |
dry-initializer-2.0.0 | spec/public_attributes_utility_spec.rb |