Sha256: a529b335f6c9e0c4eaed9e4005c0d22867ad08f3e93321b085edffea9401fb16

Contents?: true

Size: 834 Bytes

Versions: 9

Compression:

Stored size: 834 Bytes

Contents

# frozen_string_literal: true
# rubocop:todo all

require 'spec_helper'
require 'support/shared/auth_context'

describe Mongo::Auth::LDAP do

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

  include_context 'auth unit tests'

  let(:user) do
    Mongo::Auth::User.new(
      database: '$external',
      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 & 2 rubygems

Version Path
mongo-2.21.0 spec/mongo/auth/ldap_spec.rb
mongo-2.20.1 spec/mongo/auth/ldap_spec.rb
mogno-2.20.0 spec/mongo/auth/ldap_spec.rb
mogno-1.0.0 spec/mongo/auth/ldap_spec.rb
mongo-2.20.0 spec/mongo/auth/ldap_spec.rb
mongo-2.19.3 spec/mongo/auth/ldap_spec.rb
mongo-2.19.2 spec/mongo/auth/ldap_spec.rb
mongo-2.19.1 spec/mongo/auth/ldap_spec.rb
mongo-2.19.0 spec/mongo/auth/ldap_spec.rb