Sha256: 9aa354eddd2f0221082071ec0e4df8ab4f771e170442a57e678084cfa250f0cd

Contents?: true

Size: 1.07 KB

Versions: 27

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Mongo::Monitoring::Event::Secure do

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

  let(:klass) do
    Class.new do
      include Mongo::Monitoring::Event::Secure
    end
  end

  describe '#redacted' do

    let(:secure) do
      klass.new
    end

    context 'when the command must be redacted' do

      context 'when the command name is a string' do

        let(:redacted) do
          secure.redacted('saslStart', document)
        end

        it 'returns an empty document' do
          expect(redacted).to be_empty
        end
      end

      context 'when the command name is a symbol' do

        let(:redacted) do
          secure.redacted(:saslStart, document)
        end

        it 'returns an empty document' do
          expect(redacted).to be_empty
        end
      end
    end

    context 'when the command is not in the redacted list' do

      let(:redacted) do
        secure.redacted(:find, document)
      end

      it 'returns the document' do
        expect(redacted).to eq(document)
      end
    end
  end
end

Version data entries

27 entries across 24 versions & 3 rubygems

Version Path
mongo-2.4.3 spec/mongo/monitoring/event/secure_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongo-2.4.1/spec/mongo/monitoring/event/secure_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.2/spec/mongo/monitoring/event/secure_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.1/spec/mongo/monitoring/event/secure_spec.rb
mongo-2.4.2 spec/mongo/monitoring/event/secure_spec.rb
tdiary-5.0.4 vendor/bundle/gems/mongo-2.4.1/spec/mongo/monitoring/event/secure_spec.rb
mongo-2.4.1 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.4.0 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.3.1 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.4.0.rc1 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.4.0.rc0 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.3.0 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.2.7 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.2.6 spec/mongo/monitoring/event/secure_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongo-2.2.5/spec/mongo/monitoring/event/secure_spec.rb
mongo-2.2.5 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.2.4 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.2.3 spec/mongo/monitoring/event/secure_spec.rb
mongo-2.2.2 spec/mongo/monitoring/event/secure_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mongo-2.2.1/spec/mongo/monitoring/event/secure_spec.rb