Sha256: e12bef410911f8bf6cfb3fa4e5881c0c64c30c92b8ba37a85be88ff47eb3aef3

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

require_relative '../spec_helper'
require_relative '../make_db'
require 'wlog/domain/key_value'

include Wlog

describe KeyValue do 
 
  db_name = "default"
  db_path = standard_db_path(db_name)

  before(:all) do
    make_testing_db(db_name)
    @kv = KeyValue
  end

  after(:all) do
    FileUtils.rm standard_db_path(db_name)
  end

  it "Should insert a value" do
    @kv.put!('last_check', '2012')
    expect(@kv.get('last_check')).to eq('2012')
  end

  it "Should insert a value only once" do
    @kv.put!('new_check', '2012')
    @kv.put!('new_check', '2013')
    ret = KeyValue.where(:key => 'new_check')
    expect(ret.size).to eq(1)
  end

  it "Should update a previously inserted value" do
    @kv.put!('my_value', '123')
    @kv.put!('my_value', '321')
    expect(@kv.get('my_value')).to eq('321')
  end

end 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wlog-1.2.1 spec/domain/key_value_spec.rb
wlog-1.2.0 spec/domain/key_value_spec.rb