Sha256: dd5d1187feaaabe8e69cc73080a89d79eec02be17fd9e58c311763e9652f9d9b

Contents?: true

Size: 805 Bytes

Versions: 9

Compression:

Stored size: 805 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, connection)
      end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/mongo/auth/ldap_spec.rb
mongo-2.14.1 spec/mongo/auth/ldap_spec.rb
mongo-2.13.2 spec/mongo/auth/ldap_spec.rb
mongo-2.14.0 spec/mongo/auth/ldap_spec.rb
mongo-2.14.0.rc1 spec/mongo/auth/ldap_spec.rb
mongo-2.13.1 spec/mongo/auth/ldap_spec.rb
mongo-2.13.0 spec/mongo/auth/ldap_spec.rb
mongo-2.13.0.rc1 spec/mongo/auth/ldap_spec.rb
mongo-2.13.0.beta1 spec/mongo/auth/ldap_spec.rb