Sha256: b1dca99a8bac9b68ea32dc79064544e7a76ad1a253eb965caaccc3a978311f86
Contents?: true
Size: 1015 Bytes
Versions: 17
Compression:
Stored size: 1015 Bytes
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')) describe Castronaut::Adapters::Ldap::User do describe "authenticate" do it "attempts to authenticate the user" do connection = stub_everything 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
Version data entries
17 entries across 17 versions & 4 rubygems