Sha256: 1cff4a7f7d9c9499434ad9a7fdb3187ee3ad8042481c3155997af73080a0db7a

Contents?: true

Size: 1.15 KB

Versions: 34

Compression:

Stored size: 1.15 KB

Contents

require 'lite_spec_helper'

describe Mongo::Monitoring::Event::ServerDescriptionChanged 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(:previous_desc) { Mongo::Server::Description.new(address) }
  let(:updated_desc) { Mongo::Server::Description.new(address) }

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

  describe '#summary' do
    skip_if_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("#<ServerDescriptionChanged address=127.0.0.1:27017 topology=Unknown[127.0.0.1:27017] prev=#{previous_desc.inspect} new=#{updated_desc.inspect}>")
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongo-2.8.0/spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.12.4 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.6 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.12.3 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.12.2 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.10.5 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.5 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.13.0.beta1 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.12.1 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.12.0.rc0 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.4 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.10.4 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.3 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.2 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.1 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.10.3 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.0 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.9.2 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.10.2 spec/mongo/monitoring/event/server_description_changed_spec.rb
mongo-2.11.0.rc0 spec/mongo/monitoring/event/server_description_changed_spec.rb