Sha256: 207feb399e8dbabe85580731e932c321e4feb261c837ea7bfa5edebd87b3402e

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 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)
  end

  let(:connection) do
    Mongo::Server::Connection.new(server)
  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

5 entries across 5 versions & 1 rubygems

Version Path
mongo-2.0.2 spec/mongo/auth/ldap_spec.rb
mongo-2.0.1 spec/mongo/auth/ldap_spec.rb
mongo-2.0.0 spec/mongo/auth/ldap_spec.rb
mongo-2.0.0.rc spec/mongo/auth/ldap_spec.rb
mongo-2.0.0.beta spec/mongo/auth/ldap_spec.rb