Sha256: d62b2491ec83bf479d2f3d212e84f096704c6797d671c72172bb7a4b61bf836e

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

require 'tataru'

describe Tataru::Instructions::ValueUpdateInstruction do
  it 'sets temp with update action of resource' do
    mem = Tataru::Memory.new
    instr = Tataru::Instructions::ValueUpdateInstruction.new('thething')

    mem.hash[:update_action] = {
      'thething' => :hello
    }

    mem.hash[:temp] = {}

    instr.memory = mem
    instr.run

    expect(mem.hash[:temp]).to eq(
      result: :hello
    )
  end

  it 'throws if no such resource' do
    mem = Tataru::Memory.new
    instr = Tataru::Instructions::ValueUpdateInstruction.new('thething')

    mem.hash[:update_action] = {}

    mem.hash[:temp] = {}

    instr.memory = mem
    expect { instr.run }.to raise_error "No value set for 'thething'"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tataru-0.2.0 spec/instructions/value_update_instruction_spec.rb