Sha256: 03fe7d0e2e8a24ec8775b2f51b338a993bc6ed4049fe9b82786f9d9b5af5ade4

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

require 'ldap/server/operation'

describe LDAP::Server::Operation do
  let(:server) { double 'server' }
  let(:connection) { double "connection", opt: { schema: schema, server: server } }
  let(:message_id) { 337 }
  subject(:operation) { LDAP::Server::Operation.new connection, message_id }

  context 'on search' do
    before do
      operation.instance_variable_set :@attributes, attributes
      operation.instance_variable_set :@rescount, 0
    end

    context 'with schema and wildcard attribute query' do
      let(:schema) do
        double('schema').tap do |schema|
          allow(schema).to receive(:find_attrtype).and_return nil
          allow(schema).to receive(:find_attrtype).with('attr')\
              .and_return double 'attr', usage: nil
        end
      end
      let(:attributes) { %w(*) }

      describe '#send_SearchResultEntry' do
        it 'correctly handles wildcard attribute' do
          expect(connection).to receive(:write).twice do |message|
            expect(message).to include 'val'
          end

          operation.send_SearchResultEntry 'o=foo', 'attr' => 'val'
          operation.send_SearchResultEntry 'o=bar', 'attr' => 'val'
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-ldapserver-0.7.0 spec/operation_spec.rb
ruby-ldapserver-0.5.3 spec/operation_spec.rb
ruby-ldapserver-0.5.2 spec/operation_spec.rb
ruby-ldapserver-0.5.1 spec/operation_spec.rb