activeldap 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,14 @@
1
1
  h1. News
2
2
 
3
+ h2(#3-2-1). 3.2.1: 2012-08-31
4
+
5
+ * Fixed a bug that ActiveLdap::Base#delete doesn't work.
6
+ [Reported by Craig White]
7
+
8
+ h3. Thanks
9
+
10
+ * Craig White
11
+
3
12
  h2(#3-2-0). 3.2.0: 2012-08-29
4
13
 
5
14
  * [GitHub:#39] Supported Rails 3.2.8. [Reported by Ben Langfeld]
@@ -16,12 +16,19 @@ module ActiveLdap
16
16
  #
17
17
  # Delete this entry from LDAP
18
18
  def destroy
19
- self.class.delete(dn)
20
- @new_entry = true
19
+ # TODO: support deleting relations
20
+ delete
21
21
  end
22
22
 
23
23
  def delete(options={})
24
- super(dn, options)
24
+ if persisted?
25
+ default_options = {
26
+ :connection => connection,
27
+ }
28
+ self.class.delete_entry(dn, default_options.merge(options))
29
+ end
30
+ @new_entry = true
31
+ freeze
25
32
  end
26
33
 
27
34
  # save
@@ -1,3 +1,3 @@
1
1
  module ActiveLdap
2
- VERSION = "3.2.0"
2
+ VERSION = "3.2.1"
3
3
  end
@@ -791,40 +791,6 @@ class TestBase < Test::Unit::TestCase
791
791
  end
792
792
  end
793
793
 
794
- def test_delete
795
- make_temporary_user do |user1,|
796
- make_temporary_user do |user2,|
797
- make_temporary_user do |user3,|
798
- assert(@user_class.exists?(user1.uid))
799
- @user_class.delete(user1.dn)
800
- assert(!@user_class.exists?(user1.uid))
801
-
802
- assert(@user_class.exists?(user2.dn))
803
- @user_class.delete(user2.uid)
804
- assert(!@user_class.exists?(user2.dn))
805
-
806
- assert(@user_class.exists?(user3.dn))
807
- @user_class.delete("uid=#{user3.uid}")
808
- assert(!@user_class.exists?(user3.dn))
809
- end
810
- end
811
- end
812
-
813
- make_temporary_user do |user1,|
814
- make_temporary_user do |user2,|
815
- make_temporary_user do |user3,|
816
- assert(@user_class.exists?(user1.uid))
817
- assert(@user_class.exists?(user2.uid))
818
- assert(@user_class.exists?(user3.uid))
819
- @user_class.delete([user1.dn, user2.uid, "uid=#{user3.uid}"])
820
- assert(!@user_class.exists?(user1.uid))
821
- assert(!@user_class.exists?(user2.uid))
822
- assert(!@user_class.exists?(user3.uid))
823
- end
824
- end
825
- end
826
- end
827
-
828
794
  def test_inherit_base
829
795
  sub_user_class = Class.new(@user_class)
830
796
  sub_user_class.ldap_mapping :prefix => "ou=Sub"
@@ -0,0 +1,131 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'al-test-utils'
4
+
5
+ class TestPersistence < Test::Unit::TestCase
6
+ include AlTestUtils
7
+
8
+ class TestDestroy < self
9
+ class TestClass < self
10
+ def test_by_dn
11
+ make_temporary_user do |user,|
12
+ assert(@user_class.exists?(user.uid))
13
+ @user_class.destroy(user.dn)
14
+ assert(!@user_class.exists?(user.uid))
15
+ end
16
+ end
17
+
18
+ def test_by_dn_value
19
+ make_temporary_user do |user,|
20
+ assert(@user_class.exists?(user.dn))
21
+ @user_class.destroy(user.uid)
22
+ assert(!@user_class.exists?(user.dn))
23
+ end
24
+ end
25
+
26
+ def test_by_dn_attribute
27
+ make_temporary_user do |user,|
28
+ assert(@user_class.exists?(user.dn))
29
+ @user_class.destroy("uid=#{user.uid}")
30
+ assert(!@user_class.exists?(user.dn))
31
+ end
32
+ end
33
+
34
+ def test_multiple
35
+ make_temporary_user do |user1,|
36
+ make_temporary_user do |user2,|
37
+ make_temporary_user do |user3,|
38
+ assert(@user_class.exists?(user1.uid))
39
+ assert(@user_class.exists?(user2.uid))
40
+ assert(@user_class.exists?(user3.uid))
41
+ @user_class.destroy([user1.dn, user2.uid, "uid=#{user3.uid}"])
42
+ assert(!@user_class.exists?(user1.uid))
43
+ assert(!@user_class.exists?(user2.uid))
44
+ assert(!@user_class.exists?(user3.uid))
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ class TestInstance < self
52
+ def test_existence
53
+ make_temporary_user do |user,|
54
+ assert(@user_class.exists?(user.uid))
55
+ user.destroy
56
+ assert(!@user_class.exists?(user.uid))
57
+ end
58
+ end
59
+
60
+ def test_frozen
61
+ make_temporary_user do |user,|
62
+ assert_false(user.frozen?)
63
+ user.destroy
64
+ assert_true(user.frozen?)
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ class TestDelete < self
71
+ class TestClass < self
72
+ def test_by_dn
73
+ make_temporary_user do |user,|
74
+ assert(@user_class.exists?(user.uid))
75
+ @user_class.delete(user.dn)
76
+ assert(!@user_class.exists?(user.uid))
77
+ end
78
+ end
79
+
80
+ def test_by_dn_value
81
+ make_temporary_user do |user,|
82
+ assert(@user_class.exists?(user.dn))
83
+ @user_class.delete(user.uid)
84
+ assert(!@user_class.exists?(user.dn))
85
+ end
86
+ end
87
+
88
+ def test_by_dn_attribute
89
+ make_temporary_user do |user,|
90
+ assert(@user_class.exists?(user.dn))
91
+ @user_class.delete("uid=#{user.uid}")
92
+ assert(!@user_class.exists?(user.dn))
93
+ end
94
+ end
95
+
96
+ def test_multiple
97
+ make_temporary_user do |user1,|
98
+ make_temporary_user do |user2,|
99
+ make_temporary_user do |user3,|
100
+ assert(@user_class.exists?(user1.uid))
101
+ assert(@user_class.exists?(user2.uid))
102
+ assert(@user_class.exists?(user3.uid))
103
+ @user_class.delete([user1.dn, user2.uid, "uid=#{user3.uid}"])
104
+ assert(!@user_class.exists?(user1.uid))
105
+ assert(!@user_class.exists?(user2.uid))
106
+ assert(!@user_class.exists?(user3.uid))
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ class TestInstance < self
114
+ def test_existence
115
+ make_temporary_user do |user,|
116
+ assert(@user_class.exists?(user.uid))
117
+ user.delete
118
+ assert(!@user_class.exists?(user.uid))
119
+ end
120
+ end
121
+
122
+ def test_frozen
123
+ make_temporary_user do |user,|
124
+ assert_false(user.frozen?)
125
+ user.delete
126
+ assert_true(user.frozen?)
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeldap
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-28 00:00:00.000000000 Z
13
+ date: 2012-08-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -341,6 +341,7 @@ files:
341
341
  - test/test_load.rb
342
342
  - test/test_lpasswd.rb
343
343
  - test/test_object_class.rb
344
+ - test/test_persistence.rb
344
345
  - test/test_reflection.rb
345
346
  - test/test_schema.rb
346
347
  - test/test_syntax.rb
@@ -371,7 +372,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
372
  version: '0'
372
373
  segments:
373
374
  - 0
374
- hash: 1289272561367511573
375
+ hash: -4207865414253323478
375
376
  required_rubygems_version: !ruby/object:Gem::Requirement
376
377
  none: false
377
378
  requirements:
@@ -380,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
381
  version: '0'
381
382
  segments:
382
383
  - 0
383
- hash: 1289272561367511573
384
+ hash: -4207865414253323478
384
385
  requirements: []
385
386
  rubyforge_project: ruby-activeldap
386
387
  rubygems_version: 1.8.23
@@ -417,6 +418,7 @@ test_files:
417
418
  - test/test_load.rb
418
419
  - test/test_lpasswd.rb
419
420
  - test/test_object_class.rb
421
+ - test/test_persistence.rb
420
422
  - test/test_reflection.rb
421
423
  - test/test_schema.rb
422
424
  - test/test_syntax.rb