Sha256: 3d2e585e3832133a343e28b58e032f6f8f0d4877f1fcd184010e964a8e8275a0

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

shared_examples "watch" do
  it "without index, returns the value at a particular index" do
    key = random_key(4)
    value1 = uuid.generate
    value2 = uuid.generate

    index1 = client.set(key, value1).index
    index2 = client.set(key, value2).index

    expect(client.watch(key, index1).value).to eq(value1)
    expect(client.watch(key, index2).value).to eq(value2)
  end

  it "with index, waits and return when the key is updated" do
    response = nil
    key = random_key
    value = uuid.generate
    thr = Thread.new do
      response = client.watch(key)
    end
    client.set(key, value)
    thr.join
    expect(response.value).to eq(value)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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