Sha256: 38ded36fc199442bb7d72b5ca68b35e35fe5a121fa5523e64ee9c138ac19f836

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

require File.expand_path("../support", __FILE__)
require File.expand_path("../../lib/couchbase-orm/proxies/collection_proxy", __FILE__)

class Proxyfied
    def get(key, options = nil)
       raise Couchbase::Error::DocumentNotFound
    end
    def remove(key, options = nil)
        raise Couchbase::Error::DocumentNotFound
    end
end

describe CouchbaseOrm::CollectionProxy do
    it "should raise an error when get is called with bang version" do
        expect { CouchbaseOrm::CollectionProxy.new(Proxyfied.new).get!('key') }.to raise_error(Couchbase::Error::DocumentNotFound)
    end

    it "should not raise an error when get is called with non bang version" do
        expect { CouchbaseOrm::CollectionProxy.new(Proxyfied.new).get('key') }.to_not raise_error
    end

    it "should raise an error when remove is called with bang version" do
        expect { CouchbaseOrm::CollectionProxy.new(Proxyfied.new).remove!('key') }.to raise_error(Couchbase::Error::DocumentNotFound)
    end

    it "should not raise an error when remove is called with non bang version" do
        expect { CouchbaseOrm::CollectionProxy.new(Proxyfied.new).remove('key') }.to_not raise_error
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
couchbase-orm-2.0.4 spec/collection_proxy_spec.rb
couchbase-orm-2.0.3 spec/collection_proxy_spec.rb
couchbase-orm-2.0.2 spec/collection_proxy_spec.rb
couchbase-orm-2.0.1 spec/collection_proxy_spec.rb
couchbase-orm-2.0.0 spec/collection_proxy_spec.rb