Sha256: b85ac232b43859fe7fac5b63f9fdbe20170adc0df4d6d217f1b0bcd2acf8b778

Contents?: true

Size: 703 Bytes

Versions: 15

Compression:

Stored size: 703 Bytes

Contents

require 'lite_spec_helper'

describe Mongo::Protocol::Registry do

  describe ".get" do

    context "when the type has a correspoding class" do

      before do
        described_class.register(Mongo::Protocol::Query::OP_CODE, Mongo::Protocol::Query)
      end

      let(:klass) do
        described_class.get(Mongo::Protocol::Query::OP_CODE, "message")
      end

      it "returns the class" do
        expect(klass).to eq(Mongo::Protocol::Query)
      end
    end

    context "when the type has no corresponding class" do

      it "raises an error" do
        expect {
          described_class.get(-100)
        }.to raise_error(Mongo::Error::UnsupportedMessageType)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/mongo/protocol/registry_spec.rb
mongo-2.14.1 spec/mongo/protocol/registry_spec.rb
mongo-2.15.0.alpha spec/mongo/protocol/registry_spec.rb
mongo-2.13.2 spec/mongo/protocol/registry_spec.rb
mongo-2.14.0 spec/mongo/protocol/registry_spec.rb
mongo-2.14.0.rc1 spec/mongo/protocol/registry_spec.rb
mongo-2.13.1 spec/mongo/protocol/registry_spec.rb
mongo-2.12.4 spec/mongo/protocol/registry_spec.rb
mongo-2.13.0 spec/mongo/protocol/registry_spec.rb
mongo-2.12.3 spec/mongo/protocol/registry_spec.rb
mongo-2.13.0.rc1 spec/mongo/protocol/registry_spec.rb
mongo-2.12.2 spec/mongo/protocol/registry_spec.rb
mongo-2.13.0.beta1 spec/mongo/protocol/registry_spec.rb
mongo-2.12.1 spec/mongo/protocol/registry_spec.rb
mongo-2.12.0.rc0 spec/mongo/protocol/registry_spec.rb