Sha256: 6b1c743aadbd492d72d20fe0431acb593912227da8f65aae56ffc1a664fd31e1
Contents?: true
Size: 956 Bytes
Versions: 2
Compression:
Stored size: 956 Bytes
Contents
describe "nested type argument" do subject { Test::Xyz.new("bar" => { "baz" => 42 }) } context "with nested definition only" do before do class Test::Xyz extend Dry::Initializer param :foo, as: :x do option :bar, as: :y do option :baz, proc(&:to_s), as: :z option :qux, as: :w, optional: true end end end end it "builds the type" do expect(subject.x.y.z).to eq "42" end end context "with nested and wrapped definitions" do before do class Test::Xyz extend Dry::Initializer param :foo, [], as: :x do option :bar, as: :y do option :baz, proc(&:to_s), as: :z option :qux, as: :w, optional: true end end end end it "builds the type" do x = subject.x expect(x).to be_instance_of Array expect(x.first.y.z).to eq "42" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-3.0.1 | spec/nested_type_spec.rb |
dry-initializer-3.0.0 | spec/nested_type_spec.rb |