Sha256: 9cf73a0789f295a68863ed823f97388b13e2aff0e3f5b16c53d6256acae86cb4
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
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 it "#create should succeed when the key is absent and update should fail" do key = random_key(2) value = uuid.generate expect { client.update(key, value) }.to raise_error expect { client.create(key, value) }.to_not raise_error expect(client.get(key).value).to eq(value) end it "#create should fail when the key is present and update should succeed" do key = random_key(2) value = uuid.generate client.set(key, 1) expect { client.create(key, value) }.to raise_error expect { client.update(key, value) }.to_not raise_error end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
etcd-0.0.6 | spec/functional/test_and_set_spec.rb |