Sha256: 4fc37e5506135a89dfb52292252b410331bdebd6f01b03021f29f43c224c9307

Contents?: true

Size: 904 Bytes

Versions: 3

Compression:

Stored size: 904 Bytes

Contents

require 'lite_spec_helper'

describe Mongo::Monitoring::Event::TopologyClosed 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(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('#<TopologyClosed topology=Unknown[127.0.0.1:27017]>')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongo-2.14.1 spec/mongo/monitoring/event/topology_closed_spec.rb
mongo-2.15.0.alpha spec/mongo/monitoring/event/topology_closed_spec.rb
mongo-2.14.0 spec/mongo/monitoring/event/topology_closed_spec.rb