Skip to content

Commit

Permalink
Fix 'uninitialized constant Net::LDAP::PDU::LdapPduError' error
Browse files Browse the repository at this point in the history
  • Loading branch information
unagi committed Feb 14, 2019
1 parent 9daa954 commit 3ef1c6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/net/ldap/pdu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def initialize(ber_object)
when ExtendedResponse
parse_extended_response(ber_object[1])
else
raise LdapPduError.new("unknown pdu-type: #{@app_tag}")
raise Net::LDAP::PDU::Error, "unknown pdu-type: #{@app_tag}"
end

parse_controls(ber_object[2]) if ber_object[2]
Expand Down
13 changes: 13 additions & 0 deletions test/test_ldap_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,19 @@ def test_queued_read_bind_sasl
assert result.success?
assert_equal 2, result.message_id
end

def test_invalid_pdu_type
options = {
app_tag: Net::LDAP::PDU::SearchResult,
code: Net::LDAP::ResultCodeSuccess,
matched_dn: "",
error_message: "",
}
ber = Net::BER::BerIdentifiedArray.new([options[:code], options[:matched_dn], options[:error_message]])
assert_raise Net::LDAP::PDU::Error do
Net::LDAP::PDU.new([0, ber])
end
end
end

class TestLDAPConnectionErrors < Test::Unit::TestCase
Expand Down

0 comments on commit 3ef1c6e

Please sign in to comment.