Sha256: 528e1429b4e77f8ac74eb313c5ea5c9fade1dbda388ae1ee95ba855147269d7a

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

describe 'coercion of nil' do
  before do
    class Test::Foo
      extend Dry::Initializer
      param :bar, proc(&:to_i)
    end

    class Test::Baz
      include Dry::Initializer.define -> do
        param :qux, proc(&:to_i)
      end
    end
  end

  let(:foo) { Test::Foo.new(nil) }
  let(:baz) { Test::Baz.new(nil) }

  it 'works with extend syntax' do
    expect(foo.bar).to eq 0
  end

  it 'works with include syntax' do
    expect(baz.qux).to eq 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-initializer-3.0.3 spec/coercion_of_nil_spec.rb