Sha256: 70ebfdb0202718c01ea696458d40297b8db10357ddfd8918c543fdf091bba544
Contents?: true
Size: 983 Bytes
Versions: 1
Compression:
Stored size: 983 Bytes
Contents
describe "base example" do context 'using block syntax' do before do class Test::Foo include Dry::Initializer.define { param :foo param :bar option :baz option :qux } end end it "instantiates attributes" do subject = Test::Foo.new(1, 2, baz: 3, qux: 4) expect(subject.foo).to eql 1 expect(subject.bar).to eql 2 expect(subject.baz).to eql 3 expect(subject.qux).to eql 4 end end context 'using lambda syntax' do before do class Test::Foo include Dry::Initializer.define -> do param :foo param :bar option :baz option :qux end end end it "instantiates attributes" do subject = Test::Foo.new(1, 2, baz: 3, qux: 4) expect(subject.foo).to eql 1 expect(subject.bar).to eql 2 expect(subject.baz).to eql 3 expect(subject.qux).to eql 4 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-0.1.1 | spec/dry/container_spec.rb |