|  | 
| 7 | 7 |         flexmock(TCPSocket). | 
| 8 | 8 |           should_receive(:new).and_raise(Errno::ECONNREFUSED) | 
| 9 | 9 |       end | 
| 10 |  | -       | 
|  | 10 | + | 
| 11 | 11 |       it "should raise LdapError" do | 
| 12 | 12 |         lambda { | 
| 13 | 13 |           Net::LDAP::Connection.new( | 
| 14 |  | -            :server => 'test.mocked.com',  | 
|  | 14 | +            :server => 'test.mocked.com', | 
| 15 | 15 |             :port   => 636) | 
| 16 | 16 |         }.should raise_error(Net::LDAP::LdapError) | 
| 17 | 17 |       end | 
|  | 
| 21 | 21 |         flexmock(TCPSocket). | 
| 22 | 22 |           should_receive(:new).and_raise(SocketError) | 
| 23 | 23 |       end | 
| 24 |  | -       | 
|  | 24 | + | 
| 25 | 25 |       it "should raise LdapError" do | 
| 26 | 26 |         lambda { | 
| 27 | 27 |           Net::LDAP::Connection.new( | 
| 28 |  | -            :server => 'test.mocked.com',  | 
|  | 28 | +            :server => 'test.mocked.com', | 
| 29 | 29 |             :port   => 636) | 
| 30 | 30 |         }.should raise_error(Net::LDAP::LdapError) | 
| 31 | 31 |       end | 
|  | 
| 35 | 35 |         flexmock(TCPSocket). | 
| 36 | 36 |           should_receive(:new).and_raise(NameError) | 
| 37 | 37 |       end | 
| 38 |  | -       | 
|  | 38 | + | 
| 39 | 39 |       it "should rethrow the exception" do | 
| 40 | 40 |         lambda { | 
| 41 | 41 |           Net::LDAP::Connection.new( | 
| 42 |  | -            :server => 'test.mocked.com',  | 
|  | 42 | +            :server => 'test.mocked.com', | 
| 43 | 43 |             :port   => 636) | 
| 44 | 44 |         }.should raise_error(NameError) | 
| 45 | 45 |       end | 
|  | 
| 61 | 61 |       @tcp_socket.should_receive(:read_ber).and_return([2, ber]) | 
| 62 | 62 | 
 | 
| 63 | 63 |       result = subject.modify(:dn => "1", :operations => [[:replace, "mail", "[email protected]"]]) | 
| 64 |  | -      result.status.should == :failure | 
|  | 64 | +      result.should be_failure | 
| 65 | 65 |       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" | 
| 66 | 66 |     end | 
| 67 | 67 | 
 | 
|  | 
| 71 | 71 |       @tcp_socket.should_receive(:read_ber).and_return([2, ber]) | 
| 72 | 72 | 
 | 
| 73 | 73 |       result = subject.modify(:dn => "1", :operations => [[:replace, "mail", "[email protected]"]]) | 
| 74 |  | -      result.status.should == :success | 
|  | 74 | +      result.should be_success | 
| 75 | 75 |       result.error_message.should == "" | 
| 76 | 76 |     end | 
| 77 | 77 |   end | 
|  | 
0 commit comments