Sha256: a6fd19a13b70aa9abde2cf711d905b5ac67e4fc06866f77259a3b8d314d1ae0e

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'lite_spec_helper'

describe Mongo::Monitoring::Event::CommandStarted do

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

  describe '#initialize' do

    let(:command) do
      BSON::Document.new(test: 'value')
    end

    context 'when the command should be redacted' do

      let(:event) do
        described_class.new('copydb', 'admin', address, 1, 2, command)
      end

      it 'sets the command to an empty document' do
        expect(event.command).to be_empty
      end
    end
  end

  describe '#command_name' do
    context 'when command_name is given as a string' do
      let(:event) do
        described_class.new('find', 'admin', address, 1, 2, {})
      end

      it 'is a string' do
        expect(event.command_name).to eql('find')
      end
    end

    context 'when command_name is given as a symbol' do
      let(:event) do
        described_class.new(:find, 'admin', address, 1, 2, {})
      end

      it 'is a string' do
        expect(event.command_name).to eql('find')
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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