Sha256: 430f96c39d403d8a730272ef180b292d6a4e966a9d6da1303f7276ba0f66623b

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

shared_examples "test_and_set" do
  it "should pass when prev value is correct" do
    key = random_key(2)
    old_value = uuid.generate
    new_value = uuid.generate
    client.set(key, old_value)
    client.test_and_set(key, new_value, old_value)
    expect(client.get(key).value).to eq(new_value)
  end

  it "should fail when prev value is incorrect" do
    key = random_key(2)
    value = uuid.generate
    client.set(key, value)
    expect{ client.test_and_set(key, 10, 2)}.to raise_error(Net::HTTPServerException)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
etcd-0.0.5 spec/functional/test_and_set_spec.rb
etcd-0.0.4 spec/functional/test_and_set_spec.rb