Sha256: b44b02af78da203e0b1db1ce7c34f21ea6a09dcaf0e3572d5fb5b2fe9450d57c
Contents?: true
Size: 991 Bytes
Versions: 4
Compression:
Stored size: 991 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({}).as_null_object 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({}).as_null_object 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" end end end
Version data entries
4 entries across 4 versions & 3 rubygems