Sha256: eda00e77ff17578d7f80836dd37e71bcddc9db8ac1bac04b4a935e7b0cfc8259

Contents?: true

Size: 817 Bytes

Versions: 5

Compression:

Stored size: 817 Bytes

Contents

require 'spec_helper'

describe Mongo::Auth::LDAP do

  let(:server) do
    authorized_client.cluster.next_primary
  end

  let(:connection) do
    Mongo::Server::Connection.new(server, SpecConfig.instance.test_options)
  end

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

  describe '#login' do

    before do
      connection.connect!
    end

    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 'attempts to log 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.12.4 spec/mongo/auth/ldap_spec.rb
mongo-2.12.3 spec/mongo/auth/ldap_spec.rb
mongo-2.12.2 spec/mongo/auth/ldap_spec.rb
mongo-2.12.1 spec/mongo/auth/ldap_spec.rb
mongo-2.12.0.rc0 spec/mongo/auth/ldap_spec.rb