Sha256: bba757073a83b0ce76b1b55247f578563dbaa21595552a3478d4fe3eeca30ac7

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

require 'al-test-utils'

class TestCallback < Test::Unit::TestCase
  include AlTestUtils

  priority :must
  def test_new
    initialized_entries = []
    @group_class.module_eval do
      after_initialize do
        initialized_entries << self
      end
    end
    assert_equal([], initialized_entries)
    new_group = @group_class.new(:cn => "new-cn")
    assert_equal([new_group.cn].sort,
                 initialized_entries.collect {|g| g.cn}.sort)
  end

  priority :normal
  def test_find
    make_temporary_group do |group|
      found_entries = []
      initialized_entries = []
      @group_class.module_eval do
        prepend ActiveLdap::Callbacks::CallbackedInstantiatable
        after_find do
          found_entries << self
        end
        after_initialize do
          initialized_entries << self
        end
      end

      assert_equal([], found_entries)
      assert_equal([], initialized_entries)

      found_group = @group_class.find(group.dn)

      assert_equal([found_group.cn].sort, found_entries.collect {|g| g.cn}.sort)
      assert_equal([found_group.cn].sort,
                   initialized_entries.collect {|g| g.cn}.sort)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
activeldap-7.2.1 test/test_callback.rb
activeldap-7.2.0 test/test_callback.rb
activeldap-7.0.0 test/test_callback.rb
activeldap-6.1.0 test/test_callback.rb
activeldap-6.0.4 test/test_callback.rb
activeldap-6.0.3 test/test_callback.rb
activeldap-6.0.2 test/test_callback.rb
activeldap-6.0.1 test/test_callback.rb
activeldap-6.0.0 test/test_callback.rb
activeldap-5.2.4 test/test_callback.rb
activeldap-5.2.3 test/test_callback.rb
activeldap-5.2.2 test/test_callback.rb
activeldap-5.2.1 test/test_callback.rb
activeldap-5.2.0 test/test_callback.rb
activeldap-5.1.1 test/test_callback.rb
activeldap-5.1.0 test/test_callback.rb