Sha256: 48cd959e2a917ddfff25c1e5f2552f9c7fd5bf1bb558b451110db0b2221f17b9

Contents?: true

Size: 600 Bytes

Versions: 5

Compression:

Stored size: 600 Bytes

Contents

require 'spec_helper'

describe Yaoc::TransformationDeferredCommand do
  subject{
    Yaoc::TransformationDeferredCommand.new(to: :id, from: :name, fetch_method: :fetch)
  }

  let(:source){
    {name: 'my_name'}
  }

  let(:result){
    {}
  }

  describe '#value' do
    let(:value_fetcher) { double('value fetcher proc')}

    it 'deferres access to source object' do
      expect(source).not_to receive :fetch

      subject.value(source)
    end

    it 'access to source object, when data is needed' do
      expect(source).to receive :fetch

      subject.value(source).to_s
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yaoc-0.0.13 spec/unit/lib/yaoc/transformation_deferred_command_spec.rb
yaoc-0.0.12 spec/unit/lib/yaoc/transformation_deferred_command_spec.rb
yaoc-0.0.11 spec/unit/lib/yaoc/transformation_deferred_command_spec.rb
yaoc-0.0.10 spec/unit/lib/yaoc/transformation_deferred_command_spec.rb
yaoc-0.0.9 spec/unit/lib/yaoc/transformation_deferred_command_spec.rb