Sha256: af55e7e71a4ad54f5eb5ad2f13fe3cb826bd2ea68fa99d6c4e298f1c910bb430

Contents?: true

Size: 814 Bytes

Versions: 3

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

describe Mongo::Auth::LDAP do

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

  let(:server) do
    Mongo::Server.new(address, Mongo::Event::Listeners.new, 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

3 entries across 3 versions & 1 rubygems

Version Path
mongo-2.0.5 spec/mongo/auth/ldap_spec.rb
mongo-2.0.4 spec/mongo/auth/ldap_spec.rb
mongo-2.0.3 spec/mongo/auth/ldap_spec.rb