Sha256: 8c2577e3aa1421e0cc374e77fca7737a09220af3e487187fda3894d484c603f9
Contents?: true
Size: 593 Bytes
Versions: 1
Compression:
Stored size: 593 Bytes
Contents
require 'spec_helper' RSpec.describe LazyObject do class TargetObject attr_accessor :value def method_with_yield(foo) yield foo end end let(:lazy_object) { LazyObject.new do targ = TargetObject.new targ.value = :foo targ end } it 'should call the init block and forward methods to the target object' do expect( lazy_object.value ).to eq(:foo) lazy_object.value = :bar expect( lazy_object.value ).to eq(:bar) expect( lazy_object.method_with_yield(:baz) { |foo| "--#{foo}--" } ).to eq('--baz--') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazy_object-0.0.1 | spec/lazy_object_spec.rb |