Sha256: 62005d49f5cb871e52b9adba032858195df265e3bb9f950d9fd8f6df097a222e
Contents?: true
Size: 914 Bytes
Versions: 2
Compression:
Stored size: 914 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 "is set to hash of assigned options" do subject = Test::Foo.new(1, baz: :QUX) expect(subject.instance_variable_get(:@__options__)).to eq({ baz: :QUX }) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-1.1.0 | spec/options_var_spec.rb |
dry-initializer-1.0.0 | spec/options_var_spec.rb |