Sha256: f3181ca8e06f9123b935856c3687046b4c91f6c37afc948ad11e224b87fc4636

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Mongo::Cluster::Topology do

  describe '.initial' do

    context 'when provided a replica set option' do

      let(:topology) do
        described_class.initial([ 'a' ], connect: :replica_set)
      end

      it 'returns a replica set topology' do
        expect(topology).to be_a(Mongo::Cluster::Topology::ReplicaSet)
      end
    end

    context 'when provided a standalone option' do

      let(:topology) do
        described_class.initial([ 'a' ], connect: :direct)
      end

      it 'returns a standalone topology' do
        expect(topology).to be_a(Mongo::Cluster::Topology::Standalone)
      end
    end

    context 'when provided a sharded option' do

      let(:topology) do
        described_class.initial([ 'a' ], connect: :sharded)
      end

      it 'returns a sharded topology' do
        expect(topology).to be_a(Mongo::Cluster::Topology::Sharded)
      end
    end

    context 'when provided no option' do

      context 'when a set name is in the options' do

        let(:topology) do
          described_class.initial([], replica_set: 'testing')
        end

        it 'returns a replica set topology' do
          expect(topology).to be_a(Mongo::Cluster::Topology::ReplicaSet)
        end
      end

      context 'when no set name is in the options' do

        let(:topology) do
          described_class.initial([], {})
        end

        it 'returns a standalone topology' do
          expect(topology).to be_a(Mongo::Cluster::Topology::Standalone)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongo-2.0.2 spec/mongo/cluster/topology_spec.rb
mongo-2.0.1 spec/mongo/cluster/topology_spec.rb
mongo-2.0.0 spec/mongo/cluster/topology_spec.rb
mongo-2.0.0.rc spec/mongo/cluster/topology_spec.rb
mongo-2.0.0.beta spec/mongo/cluster/topology_spec.rb