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

Version Path
3mix-castronaut-0.5.0.2 spec/castronaut/adapters/ldap/user_spec.rb
masover-castronaut-0.4.4.4 spec/castronaut/adapters/ldap/user_spec.rb
masover-castronaut-0.4.4.5 spec/castronaut/adapters/ldap/user_spec.rb
masover-castronaut-0.5.0.1 spec/castronaut/adapters/ldap/user_spec.rb
p8-castronaut-0.6.1.1 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.4.2 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.4.3 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.4.4 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.4.5 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.4.6 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.5.0 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.5.1 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.5.2 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.5.3 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.5.4 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.6.0 spec/castronaut/adapters/ldap/user_spec.rb
relevance-castronaut-0.6.1 spec/castronaut/adapters/ldap/user_spec.rb