acts_as_paranoid_dag 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ActsAsParanoidDag
1
+ # ActsAsParanoidDag [![Build Status](https://secure.travis-ci.org/fiedl/acts_as_paranoid_dag.png?branch=master)](http://travis-ci.org/fiedl/acts_as_paranoid_dag)
2
2
 
3
3
  **acts_as_paranoid_dag** is a **ruby on rails gem** that combines the gems [acts-as-dag](https://github.com/resgraph/acts-as-dag) and [rails3_acts_as_paranoid](https://github.com/goncalossilva/rails3_acts_as_paranoid) to order model instances in a polymorphic directed acyclic graph and to be able to retrieve connections deleted in the past.
4
4
 
@@ -62,6 +62,11 @@ user.links_as_child.now.count # => 1
62
62
  user.links_as_child.in_the_past.count # => 1
63
63
  user.links_as_child.now_and_in_the_past.count # => 2
64
64
  user.links_as_child.at_time( 1.hour.ago ).count # => 0
65
+
66
+ # deleting links
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
65
70
  ```
66
71
 
67
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).
@@ -1,3 +1,3 @@
1
1
  module ActsAsParanoidDag
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -103,6 +103,39 @@ describe ActsAsParanoidDag do
103
103
 
104
104
  end
105
105
 
106
+ describe "#destroy" do
107
+ before do
108
+ @user.parent_groups << @group
109
+ @link = @user.links_as_child.first
110
+ end
111
+ subject { @link.destroy }
112
+ it "should mark the link as deleted rather than really destroying it" do
113
+ @link.deleted_at.should == nil
114
+ subject
115
+ @link.deleted_at.should_not == nil
116
+ @user.links_as_child.count.should == 0
117
+ @user.links_as_child.now_and_in_the_past.count.should == 1
118
+ @user.parents.count.should == 0
119
+ end
120
+ end
121
+
122
+ describe "#destroy!" do #really delete!
123
+ before do
124
+ @user.parent_groups << @group
125
+ @link = @user.links_as_child.first
126
+ end
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
136
+ end
137
+ end
138
+
106
139
  end
107
140
 
108
141
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_paranoid_dag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-16 00:00:00.000000000 Z
12
+ date: 2013-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &82781360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '3.2'
24
+ version_requirements: *82781360
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: acts-as-dag
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &82780610 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *82780610
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: rails3_acts_as_paranoid
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &82780240 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,15 +43,10 @@ dependencies:
53
43
  version: '0'
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *82780240
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: rake
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &82803030 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
52
  - - ! '>='
@@ -69,15 +54,10 @@ dependencies:
69
54
  version: '0'
70
55
  type: :development
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
57
+ version_requirements: *82803030
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: bundler
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &82802560 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ! '>='
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '0'
86
66
  type: :development
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
68
+ version_requirements: *82802560
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: rspec-rails
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &82801980 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ! '>='
@@ -101,63 +76,43 @@ dependencies:
101
76
  version: 2.8.0
102
77
  type: :development
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: 2.8.0
79
+ version_requirements: *82801980
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: guard
112
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &82801610 !ruby/object:Gem::Requirement
113
83
  none: false
114
84
  requirements:
115
- - - '='
85
+ - - =
116
86
  - !ruby/object:Gem::Version
117
87
  version: 1.0.1
118
88
  type: :development
119
89
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - '='
124
- - !ruby/object:Gem::Version
125
- version: 1.0.1
90
+ version_requirements: *82801610
126
91
  - !ruby/object:Gem::Dependency
127
92
  name: rspec-rails
128
- requirement: !ruby/object:Gem::Requirement
93
+ requirement: &82801320 !ruby/object:Gem::Requirement
129
94
  none: false
130
95
  requirements:
131
- - - '='
96
+ - - =
132
97
  - !ruby/object:Gem::Version
133
98
  version: 2.10.0
134
99
  type: :development
135
100
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - '='
140
- - !ruby/object:Gem::Version
141
- version: 2.10.0
101
+ version_requirements: *82801320
142
102
  - !ruby/object:Gem::Dependency
143
103
  name: guard-rspec
144
- requirement: !ruby/object:Gem::Requirement
104
+ requirement: &82800970 !ruby/object:Gem::Requirement
145
105
  none: false
146
106
  requirements:
147
- - - '='
107
+ - - =
148
108
  - !ruby/object:Gem::Version
149
109
  version: 0.5.5
150
110
  type: :development
151
111
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - '='
156
- - !ruby/object:Gem::Version
157
- version: 0.5.5
112
+ version_requirements: *82800970
158
113
  - !ruby/object:Gem::Dependency
159
114
  name: sqlite3
160
- requirement: !ruby/object:Gem::Requirement
115
+ requirement: &82800700 !ruby/object:Gem::Requirement
161
116
  none: false
162
117
  requirements:
163
118
  - - ! '>='
@@ -165,15 +120,10 @@ dependencies:
165
120
  version: '0'
166
121
  type: :development
167
122
  prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
123
+ version_requirements: *82800700
174
124
  - !ruby/object:Gem::Dependency
175
125
  name: activerecord
176
- requirement: !ruby/object:Gem::Requirement
126
+ requirement: &82800420 !ruby/object:Gem::Requirement
177
127
  none: false
178
128
  requirements:
179
129
  - - ! '>='
@@ -181,12 +131,7 @@ dependencies:
181
131
  version: '0'
182
132
  type: :development
183
133
  prerelease: false
184
- version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
- requirements:
187
- - - ! '>='
188
- - !ruby/object:Gem::Version
189
- version: '0'
134
+ version_requirements: *82800420
190
135
  description: Combines `acts-as-dag` and `rails3_acts_as_dag` to order model instances
191
136
  in a polymorphic directed acyclic graph and to be able to retrieve connections deleted
192
137
  in the past.
@@ -223,15 +168,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
168
  - - ! '>='
224
169
  - !ruby/object:Gem::Version
225
170
  version: '0'
171
+ segments:
172
+ - 0
173
+ hash: 559936403
226
174
  required_rubygems_version: !ruby/object:Gem::Requirement
227
175
  none: false
228
176
  requirements:
229
177
  - - ! '>='
230
178
  - !ruby/object:Gem::Version
231
179
  version: '0'
180
+ segments:
181
+ - 0
182
+ hash: 559936403
232
183
  requirements: []
233
184
  rubyforge_project:
234
- rubygems_version: 1.8.23
185
+ rubygems_version: 1.8.11
235
186
  signing_key:
236
187
  specification_version: 3
237
188
  summary: Combines `acts-as-dag` and `rails3_acts_as_dag` to order model instances