Sha256: 82c6ea798cf48aa52c0257551916e25fd3e4bf29ccf081722fe036b49081a925

Contents?: true

Size: 1021 Bytes

Versions: 32

Compression:

Stored size: 1021 Bytes

Contents

# frozen_string_literal: true, encoding: ASCII-8BIT

require 'libcouchbase'


describe Libcouchbase::Error do
    it "define the error classes" do
        expect(Libcouchbase::Error::MapChanged.new.is_a? StandardError).to be(true)
    end

    it "should be able to look up errors" do
        expect(Libcouchbase::Error::Lookup[:empty_key]).to   be(Libcouchbase::Error::EmptyKey)
        expect(Libcouchbase::Error.lookup(:empty_key)).to    be(Libcouchbase::Error::EmptyKey)
        expect(Libcouchbase::Error.lookup(:whatwhat_key)).to be(Libcouchbase::Error::UnknownError)
        expect(Libcouchbase::Error.lookup(2)).to             be(Libcouchbase::Error::AuthError)
        expect(Libcouchbase::Error.lookup(-2)).to            be(Libcouchbase::Error::UnknownError)
    end

    it "should be able to catch generic errors" do
        begin
            raise ::Libcouchbase::Error::NoMemory, 'what what'
        rescue ::Libcouchbase::Error => e
            expect(e.message).to eq('what what')
        end
    end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
libcouchbase-mapo-1.4.1 spec/error_spec.rb
libcouchbase-1.3.2 spec/error_spec.rb
libcouchbase-1.3.0 spec/error_spec.rb
libcouchbase-1.2.8 spec/error_spec.rb
libcouchbase-1.2.7 spec/error_spec.rb
libcouchbase-1.2.6 spec/error_spec.rb
libcouchbase-1.2.5 spec/error_spec.rb
libcouchbase-1.2.4 spec/error_spec.rb
libcouchbase-1.2.3 spec/error_spec.rb
libcouchbase-1.2.2 spec/error_spec.rb
libcouchbase-1.2.1 spec/error_spec.rb
libcouchbase-1.2.0 spec/error_spec.rb
libcouchbase-1.1.1 spec/error_spec.rb
libcouchbase-1.1.0 spec/error_spec.rb
libcouchbase-1.0.4 spec/error_spec.rb
libcouchbase-1.0.3 spec/error_spec.rb
libcouchbase-1.0.2 spec/error_spec.rb
libcouchbase-1.0.1 spec/error_spec.rb
libcouchbase-1.0.0 spec/error_spec.rb
libcouchbase-0.3.3 spec/error_spec.rb