Sha256: 793d2d4bd4ae4dddf3e41ae292a863e991595870aa510bf5c36fd52d85d88ced

Contents?: true

Size: 942 Bytes

Versions: 15

Compression:

Stored size: 942 Bytes

Contents

require 'spec_helper'

describe Mongo::Auth::LDAP do

  let(:address) do
    Mongo::Address.new(DEFAULT_ADDRESS)
  end

  let(:monitoring) do
    Mongo::Monitoring.new
  end

  let(:listeners) do
    Mongo::Event::Listeners.new
  end

  let(:server) do
    Mongo::Server.new(address, double('cluster'), monitoring, listeners, TEST_OPTIONS)
  end

  let(:connection) do
    Mongo::Server::Connection.new(server, TEST_OPTIONS)
  end

  let(:user) do
    Mongo::Auth::User.new(database: TEST_DB, user: 'driver', password: 'password')
  end

  describe '#login' do

    context 'when the user is not authorized for the database' do

      let(:cr) do
        described_class.new(user)
      end

      let(:login) do
        cr.login(connection).documents[0]
      end

      it 'logs the user into the connection' do
        expect {
          cr.login(connection)
        }.to raise_error(Mongo::Auth::Unauthorized)
      end
    end
  end
end

Version data entries

15 entries across 14 versions & 3 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongo-2.2.5/spec/mongo/auth/ldap_spec.rb
mongo-2.2.5 spec/mongo/auth/ldap_spec.rb
mongo-2.2.4 spec/mongo/auth/ldap_spec.rb
mongo-2.2.3 spec/mongo/auth/ldap_spec.rb
mongo-2.2.2 spec/mongo/auth/ldap_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mongo-2.2.1/spec/mongo/auth/ldap_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mongo-2.2.1/spec/mongo/auth/ldap_spec.rb
mongo-2.2.1 spec/mongo/auth/ldap_spec.rb
mongo-2.2.0 spec/mongo/auth/ldap_spec.rb
mongo-2.2.0.rc0 spec/mongo/auth/ldap_spec.rb
mongo-2.1.2 spec/mongo/auth/ldap_spec.rb
mongo-2.1.1 spec/mongo/auth/ldap_spec.rb
mongo-2.1.0 spec/mongo/auth/ldap_spec.rb
mongo-2.1.0.rc0 spec/mongo/auth/ldap_spec.rb
mongo-2.1.0.beta spec/mongo/auth/ldap_spec.rb