Add success and failure methods.

This commit is contained in:
Michael Baker 2011-11-30 20:03:02 +00:00
parent 2763040162
commit 40f0e1857e
2 changed files with 16 additions and 8 deletions

View file

@ -128,6 +128,14 @@ class Net::LDAP::PDU
result_code == 0 ? :success : :failure result_code == 0 ? :success : :failure
end end
def success?
status == :success
end
def failure?
!success?
end
## ##
# Return serverSaslCreds, which are only present in BindResponse packets. # Return serverSaslCreds, which are only present in BindResponse packets.
#-- #--

View file

@ -61,7 +61,7 @@ describe Net::LDAP::Connection do
@tcp_socket.should_receive(:read_ber).and_return([2, ber]) @tcp_socket.should_receive(:read_ber).and_return([2, ber])
result = subject.modify(:dn => "1", :operations => [[:replace, "mail", "something@sothsdkf.com"]]) result = subject.modify(:dn => "1", :operations => [[:replace, "mail", "something@sothsdkf.com"]])
result.status.should == :failure result.should be_failure
result.error_message.should == "The provided password value was rejected by a password validator: The provided password did not contain enough characters from the character set 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. The minimum number of characters from that set that must be present in user passwords is 1" result.error_message.should == "The provided password value was rejected by a password validator: The provided password did not contain enough characters from the character set 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. The minimum number of characters from that set that must be present in user passwords is 1"
end end
@ -71,7 +71,7 @@ describe Net::LDAP::Connection do
@tcp_socket.should_receive(:read_ber).and_return([2, ber]) @tcp_socket.should_receive(:read_ber).and_return([2, ber])
result = subject.modify(:dn => "1", :operations => [[:replace, "mail", "something@sothsdkf.com"]]) result = subject.modify(:dn => "1", :operations => [[:replace, "mail", "something@sothsdkf.com"]])
result.status.should == :success result.should be_success
result.error_message.should == "" result.error_message.should == ""
end end
end end