acts_as_paranoid_dag 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d2bcf415238ff52038dcc776b8e2b1f259052b00
4
+ data.tar.gz: b3d20a16d5b554e406380c052354ebf11cd021b0
5
+ SHA512:
6
+ metadata.gz: 40e9f6d373f775097b9de5b38ce1db6e586b5eb707800cc90213b65ba2ffba7e0e2b2c077e53aa4d28a3762f175b6834ecd8abc3ad390824162356ec57cc33f5
7
+ data.tar.gz: b1b2963bdbabdba8b1682f627d015f42956d77690925cb5a26251b751450b1debf57ced71b885514ec5d28615f1f1350d21b6ee23b7722664574121e3ddd0891
data/README.md CHANGED
@@ -65,11 +65,14 @@ user.links_as_child.at_time( 1.hour.ago ).count # => 0
65
65
 
66
66
  # deleting links
67
67
  link = user.links_as_child.now.first
68
- link.destroy # mark this link as deleted, but leave it in the database
69
- link.destroy! # really delete the link from the database
68
+ link.destroy # mark this link as deleted, but leave it in the database
69
+ link.destroy! # really delete the link from the database
70
+ link.destroy_permanently # same as destroy!
70
71
  ```
71
72
 
72
- You may want to have [a look at this specs](https://github.com/fiedl/acts_as_paranoid_dag/blob/master/spec/acts_as_paranoid_dag/model_additions_spec.rb).
73
+ (You don't need to call `destroy` before calling `destroy_permanently` or `destroy!`, but you can.)
74
+
75
+ You may want to have [a look at these specs](https://github.com/fiedl/acts_as_paranoid_dag/blob/master/spec/acts_as_paranoid_dag/model_additions_spec.rb).
73
76
 
74
77
  ## Contributing
75
78
 
@@ -4,18 +4,19 @@ module ActsAsParanoidDag
4
4
 
5
5
  # This allows you to make your dag paranoid, meaning that connections are not destroyed,
6
6
  # but instead a 'deleted_at' attribute is set.
7
+ #
7
8
  # In your DagLink model replace
8
- # ```
9
- # class DagLink < ActiveRecord::Base
10
- # acts_as_dag_links options
11
- # end
12
- #```
9
+ #
10
+ # class DagLink < ActiveRecord::Base
11
+ # acts_as_dag_links options
12
+ # end
13
+ #
13
14
  # by
14
- # ```
15
- # class DagLink < ActiveRecord::Base
16
- # acts_as_dag_links options, paranoid: true
17
- # end
18
- #```
15
+ #
16
+ # class DagLink < ActiveRecord::Base
17
+ # acts_as_dag_links options, paranoid: true
18
+ # end
19
+ #
19
20
  def acts_as_dag_links( params )
20
21
 
21
22
  # Find out whether the dag link should have the paranoid extension.
@@ -53,6 +54,12 @@ module ActsAsParanoidDag
53
54
 
54
55
  module DagLinkInstanceMethods
55
56
  # here the new instance methods for the DagLink model.
57
+
58
+ # This is just an alias for the +destroy!+ method.
59
+ #
60
+ def destroy_permanently
61
+ self.destroy! # This method is defined in the rails3_acts_as_paranoid gem.
62
+ end
56
63
  end
57
64
 
58
65
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsParanoidDag
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -125,16 +125,63 @@ describe ActsAsParanoidDag do
125
125
  @link = @user.links_as_child.first
126
126
  end
127
127
  subject { @link.destroy! }
128
- it "should mark the link as deleted rather than really destroying it" do
129
- @link.deleted_at.should == nil
130
- subject
131
- @user.links_as_child.count.should == 0
132
- @user.links_as_child.now_and_in_the_past.count.should == 0
133
- @user.parents.count.should == 0
134
- DagLink.all.count.should == 0
135
- DagLink.with_deleted.all.count.should == 0
128
+
129
+ describe "for existing links" do
130
+ it "should really remove the dag link" do
131
+ @link.deleted_at.should == nil
132
+ subject
133
+ @user.links_as_child.count.should == 0
134
+ @user.links_as_child.now_and_in_the_past.count.should == 0
135
+ @user.parents.count.should == 0
136
+ DagLink.all.count.should == 0
137
+ DagLink.with_deleted.all.count.should == 0
138
+ end
139
+ end
140
+ describe "for already destroyed links" do
141
+ before { @link.destroy }
142
+ it "should really remove the dag link" do
143
+ @link.deleted_at.should_not == nil
144
+ subject
145
+ @user.links_as_child.count.should == 0
146
+ @user.links_as_child.now_and_in_the_past.count.should == 0
147
+ @user.parents.count.should == 0
148
+ DagLink.all.count.should == 0
149
+ DagLink.with_deleted.all.count.should == 0
150
+ end
136
151
  end
137
152
  end
153
+
154
+ describe "#destroy_permanently" do
155
+ before do
156
+ @user.parent_groups << @group
157
+ @link = @user.links_as_child.first
158
+ end
159
+ subject { @link.destroy_permanently }
160
+
161
+ describe "for existing links" do
162
+ it "should really remove the dag link" do
163
+ @link.deleted_at.should == nil
164
+ subject
165
+ @user.links_as_child.count.should == 0
166
+ @user.links_as_child.now_and_in_the_past.count.should == 0
167
+ @user.parents.count.should == 0
168
+ DagLink.all.count.should == 0
169
+ DagLink.with_deleted.all.count.should == 0
170
+ end
171
+ end
172
+ describe "for already destroyed links" do
173
+ before { @link.destroy }
174
+ it "should really remove the dag link" do
175
+ @link.deleted_at.should_not == nil
176
+ subject
177
+ @user.links_as_child.count.should == 0
178
+ @user.links_as_child.now_and_in_the_past.count.should == 0
179
+ @user.parents.count.should == 0
180
+ DagLink.all.count.should == 0
181
+ DagLink.with_deleted.all.count.should == 0
182
+ end
183
+ end
184
+ end
138
185
 
139
186
  end
140
187
 
metadata CHANGED
@@ -1,137 +1,169 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_paranoid_dag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sebastian Fiedlschuster
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-24 00:00:00.000000000 Z
11
+ date: 2013-09-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
- requirement: &82781360 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.2'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *82781360
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: acts-as-dag
27
- requirement: &82780610 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *82780610
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: rails3_acts_as_paranoid
38
- requirement: &82780240 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *82780240
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rake
49
- requirement: &82803030 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *82803030
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: bundler
60
- requirement: &82802560 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - '>='
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :development
67
77
  prerelease: false
68
- version_requirements: *82802560
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rspec-rails
71
- requirement: &82801980 !ruby/object:Gem::Requirement
72
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
73
86
  requirements:
74
- - - ! '>='
87
+ - - '>='
75
88
  - !ruby/object:Gem::Version
76
89
  version: 2.8.0
77
90
  type: :development
78
91
  prerelease: false
79
- version_requirements: *82801980
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: 2.8.0
80
97
  - !ruby/object:Gem::Dependency
81
98
  name: guard
82
- requirement: &82801610 !ruby/object:Gem::Requirement
83
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
84
100
  requirements:
85
- - - =
101
+ - - '='
86
102
  - !ruby/object:Gem::Version
87
103
  version: 1.0.1
88
104
  type: :development
89
105
  prerelease: false
90
- version_requirements: *82801610
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.1
91
111
  - !ruby/object:Gem::Dependency
92
112
  name: rspec-rails
93
- requirement: &82801320 !ruby/object:Gem::Requirement
94
- none: false
113
+ requirement: !ruby/object:Gem::Requirement
95
114
  requirements:
96
- - - =
115
+ - - '='
97
116
  - !ruby/object:Gem::Version
98
117
  version: 2.10.0
99
118
  type: :development
100
119
  prerelease: false
101
- version_requirements: *82801320
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 2.10.0
102
125
  - !ruby/object:Gem::Dependency
103
126
  name: guard-rspec
104
- requirement: &82800970 !ruby/object:Gem::Requirement
105
- none: false
127
+ requirement: !ruby/object:Gem::Requirement
106
128
  requirements:
107
- - - =
129
+ - - '='
108
130
  - !ruby/object:Gem::Version
109
131
  version: 0.5.5
110
132
  type: :development
111
133
  prerelease: false
112
- version_requirements: *82800970
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.5.5
113
139
  - !ruby/object:Gem::Dependency
114
140
  name: sqlite3
115
- requirement: &82800700 !ruby/object:Gem::Requirement
116
- none: false
141
+ requirement: !ruby/object:Gem::Requirement
117
142
  requirements:
118
- - - ! '>='
143
+ - - '>='
119
144
  - !ruby/object:Gem::Version
120
145
  version: '0'
121
146
  type: :development
122
147
  prerelease: false
123
- version_requirements: *82800700
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
124
153
  - !ruby/object:Gem::Dependency
125
154
  name: activerecord
126
- requirement: &82800420 !ruby/object:Gem::Requirement
127
- none: false
155
+ requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
- - - ! '>='
157
+ - - '>='
130
158
  - !ruby/object:Gem::Version
131
159
  version: '0'
132
160
  type: :development
133
161
  prerelease: false
134
- version_requirements: *82800420
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
135
167
  description: Combines `acts-as-dag` and `rails3_acts_as_dag` to order model instances
136
168
  in a polymorphic directed acyclic graph and to be able to retrieve connections deleted
137
169
  in the past.
@@ -158,33 +190,26 @@ files:
158
190
  - spec/support/schema.rb
159
191
  homepage: https://github.com/fiedl/acts_as_paranoid_dag
160
192
  licenses: []
193
+ metadata: {}
161
194
  post_install_message:
162
195
  rdoc_options: []
163
196
  require_paths:
164
197
  - lib
165
198
  required_ruby_version: !ruby/object:Gem::Requirement
166
- none: false
167
199
  requirements:
168
- - - ! '>='
200
+ - - '>='
169
201
  - !ruby/object:Gem::Version
170
202
  version: '0'
171
- segments:
172
- - 0
173
- hash: 559936403
174
203
  required_rubygems_version: !ruby/object:Gem::Requirement
175
- none: false
176
204
  requirements:
177
- - - ! '>='
205
+ - - '>='
178
206
  - !ruby/object:Gem::Version
179
207
  version: '0'
180
- segments:
181
- - 0
182
- hash: 559936403
183
208
  requirements: []
184
209
  rubyforge_project:
185
- rubygems_version: 1.8.11
210
+ rubygems_version: 2.0.3
186
211
  signing_key:
187
- specification_version: 3
212
+ specification_version: 4
188
213
  summary: Combines `acts-as-dag` and `rails3_acts_as_dag` to order model instances
189
214
  in a polymorphic directed acyclic graph and to be able to retrieve connections deleted
190
215
  in the past.