acts_as_paranoid 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_paranoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Scott
8
8
  - Goncalo Silva
9
9
  - Rick Olson
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-08-29 00:00:00.000000000 Z
13
+ date: 2021-12-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '5.2'
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '7.0'
24
+ version: '7.1'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +31,7 @@ dependencies:
31
31
  version: '5.2'
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '7.0'
34
+ version: '7.1'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: activesupport
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -41,7 +41,7 @@ dependencies:
41
41
  version: '5.2'
42
42
  - - "<"
43
43
  - !ruby/object:Gem::Version
44
- version: '7.0'
44
+ version: '7.1'
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,123 +51,133 @@ dependencies:
51
51
  version: '5.2'
52
52
  - - "<"
53
53
  - !ruby/object:Gem::Version
54
- version: '7.0'
54
+ version: '7.1'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '1.5'
62
- - - "<"
59
+ - - "~>"
63
60
  - !ruby/object:Gem::Version
64
- version: '3.0'
61
+ version: '5.14'
65
62
  type: :development
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: '1.5'
72
- - - "<"
66
+ - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: '3.0'
68
+ version: '5.14'
75
69
  - !ruby/object:Gem::Dependency
76
- name: minitest
70
+ name: minitest-focus
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '4.0'
82
- - - "<="
73
+ - - "~>"
83
74
  - !ruby/object:Gem::Version
84
- version: '6.0'
75
+ version: 1.3.0
85
76
  type: :development
86
77
  prerelease: false
87
78
  version_requirements: !ruby/object:Gem::Requirement
88
79
  requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: '4.0'
92
- - - "<="
80
+ - - "~>"
93
81
  - !ruby/object:Gem::Version
94
- version: '6.0'
82
+ version: 1.3.0
95
83
  - !ruby/object:Gem::Dependency
96
84
  name: pry
97
85
  requirement: !ruby/object:Gem::Requirement
98
86
  requirements:
99
- - - ">="
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
- version: '0'
89
+ version: 0.14.1
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
93
  requirements:
106
- - - ">="
94
+ - - "~>"
107
95
  - !ruby/object:Gem::Version
108
- version: '0'
96
+ version: 0.14.1
109
97
  - !ruby/object:Gem::Dependency
110
98
  name: rake
111
99
  requirement: !ruby/object:Gem::Requirement
112
100
  requirements:
113
- - - ">="
101
+ - - "~>"
114
102
  - !ruby/object:Gem::Version
115
- version: '0'
103
+ version: '13.0'
116
104
  type: :development
117
105
  prerelease: false
118
106
  version_requirements: !ruby/object:Gem::Requirement
119
107
  requirements:
120
- - - ">="
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '13.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake-manifest
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
121
116
  - !ruby/object:Gem::Version
122
- version: '0'
117
+ version: 0.2.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.2.0
123
125
  - !ruby/object:Gem::Dependency
124
126
  name: rdoc
125
127
  requirement: !ruby/object:Gem::Requirement
126
128
  requirements:
127
- - - ">="
129
+ - - "~>"
128
130
  - !ruby/object:Gem::Version
129
- version: '0'
131
+ version: '6.3'
130
132
  type: :development
131
133
  prerelease: false
132
134
  version_requirements: !ruby/object:Gem::Requirement
133
135
  requirements:
134
- - - ">="
136
+ - - "~>"
135
137
  - !ruby/object:Gem::Version
136
- version: '0'
138
+ version: '6.3'
137
139
  - !ruby/object:Gem::Dependency
138
140
  name: rubocop
139
141
  requirement: !ruby/object:Gem::Requirement
140
142
  requirements:
141
143
  - - "~>"
142
144
  - !ruby/object:Gem::Version
143
- version: 0.89.1
145
+ version: 1.23.0
144
146
  type: :development
145
147
  prerelease: false
146
148
  version_requirements: !ruby/object:Gem::Requirement
147
149
  requirements:
148
150
  - - "~>"
149
151
  - !ruby/object:Gem::Version
150
- version: 0.89.1
152
+ version: 1.23.0
151
153
  - !ruby/object:Gem::Dependency
152
- name: simplecov
154
+ name: rubocop-minitest
153
155
  requirement: !ruby/object:Gem::Requirement
154
156
  requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- version: 0.18.1
158
- - - "<"
157
+ - - "~>"
159
158
  - !ruby/object:Gem::Version
160
- version: 0.20.0
159
+ version: 0.17.0
161
160
  type: :development
162
161
  prerelease: false
163
162
  version_requirements: !ruby/object:Gem::Requirement
164
163
  requirements:
165
- - - ">="
164
+ - - "~>"
166
165
  - !ruby/object:Gem::Version
167
- version: 0.18.1
168
- - - "<"
166
+ version: 0.17.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.21.2
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
169
179
  - !ruby/object:Gem::Version
170
- version: 0.20.0
180
+ version: 0.21.2
171
181
  description: Check the home page for more in-depth information.
172
182
  email:
173
183
  - e@zzak.io
@@ -176,6 +186,7 @@ extensions: []
176
186
  extra_rdoc_files: []
177
187
  files:
178
188
  - CHANGELOG.md
189
+ - CONTRIBUTING.md
179
190
  - LICENSE
180
191
  - README.md
181
192
  - lib/acts_as_paranoid.rb
@@ -184,18 +195,12 @@ files:
184
195
  - lib/acts_as_paranoid/relation.rb
185
196
  - lib/acts_as_paranoid/validations.rb
186
197
  - lib/acts_as_paranoid/version.rb
187
- - test/test_associations.rb
188
- - test/test_core.rb
189
- - test/test_default_scopes.rb
190
- - test/test_helper.rb
191
- - test/test_inheritance.rb
192
- - test/test_relations.rb
193
- - test/test_validations.rb
194
198
  homepage: https://github.com/ActsAsParanoid/acts_as_paranoid
195
199
  licenses:
196
200
  - MIT
197
- metadata: {}
198
- post_install_message:
201
+ metadata:
202
+ rubygems_mfa_required: 'true'
203
+ post_install_message:
199
204
  rdoc_options: []
200
205
  require_paths:
201
206
  - lib
@@ -203,23 +208,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
208
  requirements:
204
209
  - - ">="
205
210
  - !ruby/object:Gem::Version
206
- version: 2.4.0
211
+ version: 2.6.0
207
212
  required_rubygems_version: !ruby/object:Gem::Requirement
208
213
  requirements:
209
214
  - - ">="
210
215
  - !ruby/object:Gem::Version
211
216
  version: '0'
212
217
  requirements: []
213
- rubygems_version: 3.1.2
214
- signing_key:
218
+ rubygems_version: 3.2.33
219
+ signing_key:
215
220
  specification_version: 4
216
221
  summary: Active Record plugin which allows you to hide and restore records without
217
222
  actually deleting them.
218
- test_files:
219
- - test/test_relations.rb
220
- - test/test_inheritance.rb
221
- - test/test_core.rb
222
- - test/test_default_scopes.rb
223
- - test/test_helper.rb
224
- - test/test_validations.rb
225
- - test/test_associations.rb
223
+ test_files: []
@@ -1,358 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "test_helper"
4
-
5
- class AssociationsTest < ParanoidBaseTest
6
- def test_removal_with_destroy_associations
7
- paranoid_company = ParanoidDestroyCompany.create! name: "ParanoidDestroyCompany #1"
8
- paranoid_company.paranoid_products.create! name: "ParanoidProduct #1"
9
-
10
- assert_equal 1, ParanoidDestroyCompany.count
11
- assert_equal 1, ParanoidProduct.count
12
-
13
- ParanoidDestroyCompany.first.destroy
14
- assert_equal 0, ParanoidDestroyCompany.count
15
- assert_equal 0, ParanoidProduct.count
16
- assert_equal 1, ParanoidDestroyCompany.with_deleted.count
17
- assert_equal 1, ParanoidProduct.with_deleted.count
18
-
19
- ParanoidDestroyCompany.with_deleted.first.destroy
20
- assert_equal 0, ParanoidDestroyCompany.count
21
- assert_equal 0, ParanoidProduct.count
22
- assert_equal 0, ParanoidDestroyCompany.with_deleted.count
23
- assert_equal 0, ParanoidProduct.with_deleted.count
24
- end
25
-
26
- def test_removal_with_delete_all_associations
27
- paranoid_company = ParanoidDeleteCompany.create! name: "ParanoidDestroyCompany #1"
28
- paranoid_company.paranoid_products.create! name: "ParanoidProduct #2"
29
-
30
- assert_equal 1, ParanoidDeleteCompany.count
31
- assert_equal 1, ParanoidProduct.count
32
-
33
- ParanoidDeleteCompany.first.destroy
34
- assert_equal 0, ParanoidDeleteCompany.count
35
- assert_equal 0, ParanoidProduct.count
36
- assert_equal 1, ParanoidDeleteCompany.with_deleted.count
37
- assert_equal 1, ParanoidProduct.with_deleted.count
38
-
39
- ParanoidDeleteCompany.with_deleted.first.destroy
40
- assert_equal 0, ParanoidDeleteCompany.count
41
- assert_equal 0, ParanoidProduct.count
42
- assert_equal 0, ParanoidDeleteCompany.with_deleted.count
43
- assert_equal 0, ParanoidProduct.with_deleted.count
44
- end
45
-
46
- def test_belongs_to_with_scope_option
47
- paranoid_has_many_dependant = ParanoidHasManyDependant.new
48
-
49
- expected_includes_values = ParanoidTime.includes(:not_paranoid).includes_values
50
- includes_values = paranoid_has_many_dependant
51
- .association(:paranoid_time_with_scope).scope.includes_values
52
-
53
- assert_equal expected_includes_values, includes_values
54
-
55
- paranoid_time = ParanoidTime.create(name: "not-hello")
56
- paranoid_has_many_dependant.paranoid_time = paranoid_time
57
- paranoid_has_many_dependant.save!
58
-
59
- assert_nil paranoid_has_many_dependant.paranoid_time_with_scope
60
-
61
- paranoid_time.update(name: "hello")
62
-
63
- paranoid_has_many_dependant.reload
64
-
65
- assert_equal paranoid_time, paranoid_has_many_dependant.paranoid_time_with_scope
66
-
67
- paranoid_time.destroy
68
-
69
- paranoid_has_many_dependant.reload
70
-
71
- assert_nil paranoid_has_many_dependant.paranoid_time_with_scope
72
- end
73
-
74
- def test_belongs_to_with_scope_and_deleted_option
75
- paranoid_has_many_dependant = ParanoidHasManyDependant.new
76
- includes_values = ParanoidTime.includes(:not_paranoid).includes_values
77
-
78
- assert_equal includes_values, paranoid_has_many_dependant
79
- .association(:paranoid_time_with_scope_with_deleted).scope.includes_values
80
-
81
- paranoid_time = ParanoidTime.create(name: "not-hello")
82
- paranoid_has_many_dependant.paranoid_time = paranoid_time
83
- paranoid_has_many_dependant.save!
84
-
85
- assert_nil paranoid_has_many_dependant.paranoid_time_with_scope_with_deleted
86
-
87
- paranoid_time.update(name: "hello")
88
- paranoid_has_many_dependant.reload
89
-
90
- assert_equal paranoid_time, paranoid_has_many_dependant
91
- .paranoid_time_with_scope_with_deleted
92
-
93
- paranoid_time.destroy
94
- paranoid_has_many_dependant.reload
95
-
96
- assert_equal paranoid_time, paranoid_has_many_dependant
97
- .paranoid_time_with_scope_with_deleted
98
- end
99
-
100
- def test_belongs_to_with_deleted
101
- paranoid_time = ParanoidTime.first
102
- paranoid_has_many_dependant = paranoid_time.paranoid_has_many_dependants
103
- .create(name: "dependant!")
104
-
105
- assert_equal paranoid_time, paranoid_has_many_dependant.paranoid_time
106
- assert_equal paranoid_time, paranoid_has_many_dependant.paranoid_time_with_deleted
107
-
108
- paranoid_time.destroy
109
- paranoid_has_many_dependant.reload
110
-
111
- assert_nil paranoid_has_many_dependant.paranoid_time
112
- assert_equal paranoid_time, paranoid_has_many_dependant.paranoid_time_with_deleted
113
- end
114
-
115
- def test_belongs_to_polymorphic_with_deleted
116
- paranoid_time = ParanoidTime.first
117
- paranoid_has_many_dependant = ParanoidHasManyDependant
118
- .create!(name: "dependant!", paranoid_time_polymorphic_with_deleted: paranoid_time)
119
-
120
- assert_equal paranoid_time, paranoid_has_many_dependant.paranoid_time
121
- assert_equal paranoid_time, paranoid_has_many_dependant
122
- .paranoid_time_polymorphic_with_deleted
123
-
124
- paranoid_time.destroy
125
-
126
- assert_nil paranoid_has_many_dependant.reload.paranoid_time
127
- assert_equal paranoid_time, paranoid_has_many_dependant
128
- .reload.paranoid_time_polymorphic_with_deleted
129
- end
130
-
131
- def test_belongs_to_nil_polymorphic_with_deleted
132
- paranoid_time = ParanoidTime.first
133
- paranoid_has_many_dependant =
134
- ParanoidHasManyDependant.create!(name: "dependant!",
135
- paranoid_time_polymorphic_with_deleted: nil)
136
-
137
- assert_nil paranoid_has_many_dependant.paranoid_time
138
- assert_nil paranoid_has_many_dependant.paranoid_time_polymorphic_with_deleted
139
-
140
- paranoid_time.destroy
141
-
142
- assert_nil paranoid_has_many_dependant.reload.paranoid_time
143
- assert_nil paranoid_has_many_dependant.reload.paranoid_time_polymorphic_with_deleted
144
- end
145
-
146
- def test_belongs_to_options
147
- paranoid_time = ParanoidHasManyDependant.reflections
148
- .with_indifferent_access[:paranoid_time]
149
- assert_equal :belongs_to, paranoid_time.macro
150
- assert_nil paranoid_time.options[:with_deleted]
151
- end
152
-
153
- def test_belongs_to_with_deleted_options
154
- paranoid_time_with_deleted =
155
- ParanoidHasManyDependant.reflections
156
- .with_indifferent_access[:paranoid_time_with_deleted]
157
- assert_equal :belongs_to, paranoid_time_with_deleted.macro
158
- assert paranoid_time_with_deleted.options[:with_deleted]
159
- end
160
-
161
- def test_belongs_to_polymorphic_with_deleted_options
162
- paranoid_time_polymorphic_with_deleted = ParanoidHasManyDependant.reflections
163
- .with_indifferent_access[:paranoid_time_polymorphic_with_deleted]
164
- assert_equal :belongs_to, paranoid_time_polymorphic_with_deleted.macro
165
- assert paranoid_time_polymorphic_with_deleted.options[:with_deleted]
166
- end
167
-
168
- def test_only_find_associated_records_when_finding_with_paranoid_deleted
169
- parent = ParanoidBelongsDependant.create
170
- child = ParanoidHasManyDependant.create
171
- parent.paranoid_has_many_dependants << child
172
-
173
- unrelated_parent = ParanoidBelongsDependant.create
174
- unrelated_child = ParanoidHasManyDependant.create
175
- unrelated_parent.paranoid_has_many_dependants << unrelated_child
176
-
177
- child.destroy
178
- assert_paranoid_deletion(child)
179
-
180
- parent.reload
181
-
182
- assert_equal [], parent.paranoid_has_many_dependants.to_a
183
- assert_equal [child], parent.paranoid_has_many_dependants.with_deleted.to_a
184
- end
185
-
186
- def test_join_with_model_with_deleted
187
- obj = ParanoidHasManyDependant.create(paranoid_time: ParanoidTime.create)
188
- assert_not_nil obj.paranoid_time
189
- assert_not_nil obj.paranoid_time_with_deleted
190
-
191
- obj.paranoid_time.destroy
192
- obj.reload
193
-
194
- assert_nil obj.paranoid_time
195
- assert_not_nil obj.paranoid_time_with_deleted
196
-
197
- # Note that obj is destroyed because of dependent: :destroy in ParanoidTime
198
- assert obj.destroyed?
199
-
200
- assert_empty ParanoidHasManyDependant.with_deleted.joins(:paranoid_time)
201
- assert_equal [obj],
202
- ParanoidHasManyDependant.with_deleted.joins(:paranoid_time_with_deleted)
203
- end
204
-
205
- def test_includes_with_deleted
206
- paranoid_time = ParanoidTime.first
207
- paranoid_time.paranoid_has_many_dependants.create(name: "dependant!")
208
-
209
- paranoid_time.destroy
210
-
211
- ParanoidHasManyDependant.with_deleted
212
- .includes(:paranoid_time_with_deleted).each do |hasmany|
213
- assert_not_nil hasmany.paranoid_time_with_deleted
214
- end
215
- end
216
-
217
- def test_includes_with_deleted_with_polymorphic_parent
218
- not_paranoid_parent = NotParanoidHasManyAsParent.create(name: "not paranoid parent")
219
- paranoid_parent = ParanoidHasManyAsParent.create(name: "paranoid parent")
220
- ParanoidBelongsToPolymorphic.create(name: "belongs_to", parent: not_paranoid_parent)
221
- ParanoidBelongsToPolymorphic.create(name: "belongs_to", parent: paranoid_parent)
222
-
223
- paranoid_parent.destroy
224
-
225
- ParanoidBelongsToPolymorphic.with_deleted.includes(:parent).each do |hasmany|
226
- assert_not_nil hasmany.parent
227
- end
228
- end
229
-
230
- def test_cannot_find_a_paranoid_deleted_many_many_association
231
- left = ParanoidManyManyParentLeft.create
232
- right = ParanoidManyManyParentRight.create
233
- left.paranoid_many_many_parent_rights << right
234
-
235
- left.paranoid_many_many_parent_rights.delete(right)
236
-
237
- left.reload
238
-
239
- assert_equal [], left.paranoid_many_many_children, "Linking objects not deleted"
240
- assert_equal [], left.paranoid_many_many_parent_rights,
241
- "Associated objects not unlinked"
242
- assert_equal right, ParanoidManyManyParentRight.find(right.id),
243
- "Associated object deleted"
244
- end
245
-
246
- def test_cannot_find_a_paranoid_destroyed_many_many_association
247
- left = ParanoidManyManyParentLeft.create
248
- right = ParanoidManyManyParentRight.create
249
- left.paranoid_many_many_parent_rights << right
250
-
251
- left.paranoid_many_many_parent_rights.destroy(right)
252
-
253
- left.reload
254
-
255
- assert_equal [], left.paranoid_many_many_children, "Linking objects not deleted"
256
- assert_equal [], left.paranoid_many_many_parent_rights,
257
- "Associated objects not unlinked"
258
- assert_equal right, ParanoidManyManyParentRight.find(right.id),
259
- "Associated object deleted"
260
- end
261
-
262
- def test_cannot_find_a_has_many_through_object_when_its_linking_object_is_soft_destroyed
263
- left = ParanoidManyManyParentLeft.create
264
- right = ParanoidManyManyParentRight.create
265
- left.paranoid_many_many_parent_rights << right
266
-
267
- child = left.paranoid_many_many_children.first
268
-
269
- child.destroy
270
-
271
- left.reload
272
-
273
- assert_equal [], left.paranoid_many_many_parent_rights, "Associated objects not deleted"
274
- end
275
-
276
- def test_cannot_find_a_paranoid_deleted_model
277
- model = ParanoidBelongsDependant.create
278
- model.destroy
279
-
280
- assert_raises ActiveRecord::RecordNotFound do
281
- ParanoidBelongsDependant.find(model.id)
282
- end
283
- end
284
-
285
- def test_bidirectional_has_many_through_association_clear_is_paranoid
286
- left = ParanoidManyManyParentLeft.create
287
- right = ParanoidManyManyParentRight.create
288
- left.paranoid_many_many_parent_rights << right
289
-
290
- child = left.paranoid_many_many_children.first
291
- assert_equal left, child.paranoid_many_many_parent_left,
292
- "Child's left parent is incorrect"
293
- assert_equal right, child.paranoid_many_many_parent_right,
294
- "Child's right parent is incorrect"
295
-
296
- left.paranoid_many_many_parent_rights.clear
297
-
298
- assert_paranoid_deletion(child)
299
- end
300
-
301
- def test_bidirectional_has_many_through_association_destroy_is_paranoid
302
- left = ParanoidManyManyParentLeft.create
303
- right = ParanoidManyManyParentRight.create
304
- left.paranoid_many_many_parent_rights << right
305
-
306
- child = left.paranoid_many_many_children.first
307
- assert_equal left, child.paranoid_many_many_parent_left,
308
- "Child's left parent is incorrect"
309
- assert_equal right, child.paranoid_many_many_parent_right,
310
- "Child's right parent is incorrect"
311
-
312
- left.paranoid_many_many_parent_rights.destroy(right)
313
-
314
- assert_paranoid_deletion(child)
315
- end
316
-
317
- def test_bidirectional_has_many_through_association_delete_is_paranoid
318
- left = ParanoidManyManyParentLeft.create
319
- right = ParanoidManyManyParentRight.create
320
- left.paranoid_many_many_parent_rights << right
321
-
322
- child = left.paranoid_many_many_children.first
323
- assert_equal left, child.paranoid_many_many_parent_left,
324
- "Child's left parent is incorrect"
325
- assert_equal right, child.paranoid_many_many_parent_right,
326
- "Child's right parent is incorrect"
327
-
328
- left.paranoid_many_many_parent_rights.delete(right)
329
-
330
- assert_paranoid_deletion(child)
331
- end
332
-
333
- def test_belongs_to_on_normal_model_is_paranoid
334
- not_paranoid = HasOneNotParanoid.create
335
- not_paranoid.paranoid_time = ParanoidTime.create
336
-
337
- assert not_paranoid.save
338
- assert_not_nil not_paranoid.paranoid_time
339
- end
340
-
341
- def test_double_belongs_to_with_deleted
342
- not_paranoid = DoubleHasOneNotParanoid.create
343
- not_paranoid.paranoid_time = ParanoidTime.create
344
-
345
- assert not_paranoid.save
346
- assert_not_nil not_paranoid.paranoid_time
347
- end
348
-
349
- def test_mass_assignment_of_paranoid_column_enabled
350
- if Gem.loaded_specs["activerecord"].version >= Gem::Version.new("5.2.0")
351
- skip "Creation as deleted is not supported with Rails >= 5.2"
352
- end
353
- now = Time.now
354
- record = ParanoidTime.create! name: "Foo", deleted_at: now
355
- assert_equal "Foo", record.name
356
- assert_equal now, record.deleted_at
357
- end
358
- end