Sha256: 04882f22b5a802770407aa0052b3cc192fe532e58bfd5100498381c466c8a164

Contents?: true

Size: 488 Bytes

Versions: 3

Compression:

Stored size: 488 Bytes

Contents

require 'spec_helper'

shared_examples Etcd::Helpers do
  describe "#has_key" do
    it "should return true when the key is present" do
      client.should_receive(:get).with('/foo/bar').and_return({})
      expect(client.has_key?('/foo/bar')).to be_true
    end
    it "should return false when the key is absent" do
      client.should_receive(:get).with('/foo/bar').and_raise(Net::HTTPServerException.new('',''))
      expect(client.has_key?('/foo/bar')).to be_false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
etcd-0.0.6 spec/unit/etcd/mixins/helpers_spec.rb
etcd-0.0.5 spec/unit/etcd/mixins/helpers_spec.rb
etcd-0.0.4 spec/unit/etcd/mixins/helpers_spec.rb