Sha256: 2fedc86a69dd207da1fc129322e3a614b94ac000ce1bb18adb250372b27c0f85

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Adhearsion::LDAP::Plugin::Service do

  describe "while initializing" do
    after do
      reset_adhearsion_ldap_config
    end

    it "should raise an exception when no host has been configured" do
      lambda { Adhearsion::Plugin.init_plugins }.should raise_error "Must supply a host argument to the LDAP configuration"
    end

    it "should raise an exception when an invalid port has been configured" do
      Adhearsion.config[:adhearsion_ldap].host = "localhost"
      Adhearsion.config[:adhearsion_ldap].port = "389"
      lambda { Adhearsion::Plugin.init_plugins }.should raise_error "Must supply a valid port to the LDAP configuration"
    end
  end

  describe "when starting the LDAP connection" do
    before do
      Adhearsion.config[:adhearsion_ldap].host = "localhost"
      Adhearsion::LDAP::Plugin::Service.any_instance.should_receive(:require_models).and_return true
    end

    after do
      reset_adhearsion_ldap_config
    end

    it "should call Connection.start method with the valid parameters" do
      Adhearsion::LDAP::Plugin::Service.any_instance.should_receive(:establish_connection).with("localhost", 389, "", "", "", false, false).and_return true
      Adhearsion::Plugin.init_plugins
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adhearsion-ldap-0.1.0 spec/adhearsion/ldap/plugin/service_spec.rb