Sha256: 8e07d7ca8b2d5692aeac016e8a2b53372afb17afb6ad262b764988bfb562a6fd

Contents?: true

Size: 898 Bytes

Versions: 11

Compression:

Stored size: 898 Bytes

Contents

require 'lite_spec_helper'

describe Mongo::Error::NoServerAvailable do
  describe 'message' do
    let(:selector) do
      Mongo::ServerSelector::Primary.new
    end

    let(:cluster) do
      Mongo::Cluster.new(['127.0.0.1:27017'],
        Mongo::Monitoring.new, monitoring_io: false)
    end

    let(:error) do
      Mongo::Error::NoServerAvailable.new(selector, cluster)
    end

    it 'is correct' do
      expect(error.message).to eq('No primary server is available in cluster: #<Cluster topology=Unknown[127.0.0.1:27017] servers=[#<Server address=127.0.0.1:27017 UNKNOWN>]> with timeout=30, LT=0.015')
    end

    context 'when cluster is nil' do
      let(:error) do
        Mongo::Error::NoServerAvailable.new(selector, nil)
      end

      it 'is correct' do
        expect(error.message).to eq('No primary server is available with timeout=30, LT=0.015')
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/mongo/error/no_server_available_spec.rb
mongo-2.13.2 spec/mongo/error/no_server_available_spec.rb
mongo-2.13.1 spec/mongo/error/no_server_available_spec.rb
mongo-2.12.4 spec/mongo/error/no_server_available_spec.rb
mongo-2.13.0 spec/mongo/error/no_server_available_spec.rb
mongo-2.12.3 spec/mongo/error/no_server_available_spec.rb
mongo-2.13.0.rc1 spec/mongo/error/no_server_available_spec.rb
mongo-2.12.2 spec/mongo/error/no_server_available_spec.rb
mongo-2.13.0.beta1 spec/mongo/error/no_server_available_spec.rb
mongo-2.12.1 spec/mongo/error/no_server_available_spec.rb
mongo-2.12.0.rc0 spec/mongo/error/no_server_available_spec.rb