Sha256: 3a5ce911d83170ab03a0fde320993de1f1050b3125155382773157123c708c10
Contents?: true
Size: 703 Bytes
Versions: 7
Compression:
Stored size: 703 Bytes
Contents
RSpec.describe Yaks::Builder do class Buildable include Yaks::Attributes.new(:foo, :bar) def self.create(foo, bar) new(foo: foo, bar: bar) end def finalize with(foo: 7, bar: 8) end def wrong_type(x, y) "foo #{x} #{y}" end end subject do Yaks::Builder.new(Buildable) do def_set :foo, :bar def_forward :finalize, :wrong_type, :update end end it 'should keep state' do expect( subject.create(3, 4) do foo 7 update bar: 6 end.to_h ).to eql(foo: 7, bar: 6) end it 'should unwrap again' do expect( subject.create(3, 4) { finalize } ).to eql Buildable.new(foo: 7, bar: 8) end end
Version data entries
7 entries across 7 versions & 1 rubygems