You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

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