Sha256: c47c8d20c0b7a4f3ea4da14fa4c51fbd4f9f6fd3834bbb89e04316ebd6711f16

Contents?: true

Size: 982 Bytes

Versions: 18

Compression:

Stored size: 982 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'lite_spec_helper'

describe Mongo::Monitoring::Event::ServerClosed do

  let(:address) do
    Mongo::Address.new('127.0.0.1:27017')
  end

  let(:monitoring) { double('monitoring') }

  let(:cluster) do
    double('cluster').tap do |cluster|
      allow(cluster).to receive(:addresses).and_return([address])
      allow(cluster).to receive(:servers_list).and_return([])
    end
  end

  let(:topology) do
    Mongo::Cluster::Topology::Unknown.new({}, monitoring, cluster)
  end

  let(:event) do
    described_class.new(address, topology)
  end

  describe '#summary' do
    require_no_linting

    it 'renders correctly' do
      expect(topology).to receive(:server_descriptions).and_return({
        '127.0.0.1:27017' => Mongo::Server::Description.new(Mongo::Address.new('127.0.0.1:27017'))})
      expect(event.summary).to eq('#<ServerClosed address=127.0.0.1:27017 topology=Unknown[127.0.0.1:27017]>')
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mongo-2.16.4 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.17.4 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.18.3 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.18.2 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.17.3 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.18.1 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.18.0 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.17.2 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.16.3 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.18.0.beta1 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.16.2 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.17.1 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.16.1 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.17.0 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.16.0 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.15.1 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.16.0.alpha1 spec/mongo/monitoring/event/server_closed_spec.rb
mongo-2.15.0 spec/mongo/monitoring/event/server_closed_spec.rb