Sha256: 49498f22e15e0ee35685088236b4d19f031cdc0ab394717ffeaecaed0f899233

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe NSISam do

  before :all do
    @nsisam = NSISam::Client.new 'http://test:test@localhost:8888'
    @keys = Array.new
  end

  after :all do
    @keys.each { |key| @nsisam.delete(key) }
  end

  it "can store a value in SAM" do
    response = @nsisam.store("something")
    response.should_not be_nil
    response.should have_key("key")
    response.should have_key("checksum")

    @keys.push(response["key"])
  end

  it "can delete a stored value" do
    key = @nsisam.store("delete this")["key"]
    response = @nsisam.delete(key)
    response["deleted"].should be_true
  end

  it "can retrieve a stored value" do
    key = @nsisam.store("retrieve this")["key"]
    response = @nsisam.get(key)
    response["data"].should == "retrieve this"

    @keys.push(key)
  end

  it "can update values in keys already stored" do
    key = @nsisam.store("update this")["key"]
    response = @nsisam.update(key, "updated")
    response["key"].should == key
    response.should have_key("checksum")

    @keys.push(key)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nsisam-0.1.0 spec/nsisam_spec.rb