spec/castronaut/adapters/ldap/user_spec.rb in relevance-castronaut-0.4.1 vs spec/castronaut/adapters/ldap/user_spec.rb in relevance-castronaut-0.4.2

- old
+ new

@@ -9,8 +9,17 @@ Net::LDAP.stub!(:new).and_return(connection) connection.should_receive(:authenticate).with('cn=bob, dc=example, dc=com, ', '1234').and_return(nil) Castronaut::Adapters::Ldap::User.authenticate('cn=bob, dc=example, dc=com', '1234') end + it "returns a failed to authenticate message when authentication fails" do + connection = stub_everything + Net::LDAP.stub!(:new).and_return(connection) + connection.stub!(:authenticate).and_return(nil) + connection.stub!(:bind).and_return(false) + result = Castronaut::Adapters::Ldap::User.authenticate('cn=bob, dc=example, dc=com', 'bad_password') + result.error_message.should == "Unable to authenticate the username cn=bob, dc=example, dc=com" + end + end end