Sha256: ed1a72e86a32c3f1af8bd83fcf1b0b1e196c5789529e73241cb5351aff6f8f7c

Contents?: true

Size: 863 Bytes

Versions: 6

Compression:

Stored size: 863 Bytes

Contents

require 'spec_helper'

describe Yakg do
  pw_name = SecureRandom.hex 4
  pw_value = SecureRandom.hex 4
  new_pw_name = SecureRandom.hex 4

  it "pre-nukes everything" do
    Yakg.list.each {|x| Yakg.unset x }
    Yakg.list.should eq []
  end
  
  it "confirms nonexistent keys are nil" do
    Yakg.get(pw_name).should be_nil
  end

  it "can create a key" do
    Yakg.set(pw_name, pw_value).should be_true
    Yakg.get(pw_name).should eq pw_value
  end

  it "can list keys" do
    Yakg.set(new_pw_name, SecureRandom.hex(4))
    Yakg.list.should eq [pw_name, new_pw_name]
  end
  
  it "can update keys" do
    new_pw_value = SecureRandom.hex 4
    Yakg.set(pw_name, new_pw_value).should be_true
    Yakg.get(pw_name).should eq new_pw_value
  end

  it "can delete a key" do
    Yakg.unset(pw_name).should be_true
    Yakg.get(pw_name).should be_nil
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yakg-0.0.8 spec/yakg_spec.rb
yakg-0.0.6 spec/yakg_spec.rb
yakg-0.0.4 spec/yakg_spec.rb
yakg-0.0.3 spec/yakg_spec.rb
yakg-0.0.2 spec/yakg_spec.rb
yakg-0.0.1 spec/yakg_spec.rb