Sha256: 6a8aa496f4333c0be86e19f794d4020206ecf43d069e5a28b4177021183efb28

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

require 'tataru'

describe Tataru::Instructions::ValueInstruction do
  it 'set a value' do
    mem = Tataru::Memory.new
    instr = Tataru::Instructions::ValueInstruction.new('something')

    mem.hash[:temp] = { _key: :somefield }
    instr.memory = mem
    instr.run

    expect(mem.hash[:temp]).to eq(somefield: 'something')
  end

  it 'returns an error if no key' do
    mem = Tataru::Memory.new
    instr = Tataru::Instructions::ValueInstruction.new('something')

    mem.hash[:temp] = {}
    instr.memory = mem
    instr.run

    expect(mem.error).to eq 'No key set'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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