Sha256: ffdf50d7b6bc05f14c5f8e258447eee0ef2da9e66a217c805552c8bd1e57100e
Contents?: true
Size: 712 Bytes
Versions: 5
Compression:
Stored size: 712 Bytes
Contents
describe "custom dispatchers" do subject { Test::Foo.new "123" } before do dispatcher = ->(op) { op[:integer] ? op.merge(type: proc(&:to_i)) : op } Dry::Initializer::Dispatchers << dispatcher end context "with extend syntax" do before do class Test::Foo extend Dry::Initializer param :id, integer: true end end it "adds syntax sugar" do expect(subject.id).to eq 123 end end context "with include syntax" do before do class Test::Foo include Dry::Initializer.define -> do param :id, integer: true end end end it "adds syntax sugar" do expect(subject.id).to eq 123 end end end
Version data entries
5 entries across 5 versions & 1 rubygems