Sha256: 1b8b8d052f0039932f3b7143766e35a79aefe306d867d39db4aee434f9aef2f1
Contents?: true
Size: 918 Bytes
Versions: 3
Compression:
Stored size: 918 Bytes
Contents
describe "@__options__" do context "when class has no options" do before do class Test::Foo extend Dry::Initializer::Mixin param :foo end end it "is set to empty hash" do subject = Test::Foo.new(1) expect(subject.instance_variable_get(:@__options__)).to eq({}) end end context "when class has options" do before do class Test::Foo extend Dry::Initializer::Mixin param :foo option :bar, optional: true option :baz, optional: true end end it "is set to empty hash if no options assigned" do subject = Test::Foo.new(1) expect(subject.instance_variable_get(:@__options__)).to eq({}) end it "slices allowed options only" do subject = Test::Foo.new(1, baz: :QUX, qux: :BAZ) expect(subject.instance_variable_get(:@__options__)).to eq({ baz: :QUX }) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-1.1.3 | spec/options_var_spec.rb |
dry-initializer-1.1.2 | spec/options_var_spec.rb |
dry-initializer-1.1.1 | spec/options_var_spec.rb |