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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +70 -0
- data/CONTRIBUTING.md +58 -0
- data/README.md +5 -5
- data/lib/acts_as_paranoid/core.rb +80 -55
- data/lib/acts_as_paranoid/relation.rb +1 -1
- data/lib/acts_as_paranoid/version.rb +1 -1
- data/lib/acts_as_paranoid.rb +4 -4
- metadata +71 -73
- data/test/test_associations.rb +0 -358
- data/test/test_core.rb +0 -633
- data/test/test_default_scopes.rb +0 -53
- data/test/test_helper.rb +0 -541
- data/test/test_inheritance.rb +0 -16
- data/test/test_relations.rb +0 -125
- data/test/test_validations.rb +0 -45
data/test/test_validations.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "test_helper"
|
4
|
-
|
5
|
-
class ValidatesUniquenessTest < ParanoidBaseTest
|
6
|
-
def test_should_include_deleted_by_default
|
7
|
-
ParanoidTime.new(name: "paranoid").tap do |record|
|
8
|
-
assert !record.valid?
|
9
|
-
ParanoidTime.first.destroy
|
10
|
-
assert !record.valid?
|
11
|
-
ParanoidTime.only_deleted.first.destroy!
|
12
|
-
assert record.valid?
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_validate_without_deleted
|
17
|
-
ParanoidBoolean.new(name: "paranoid").tap do |record|
|
18
|
-
refute record.valid?
|
19
|
-
ParanoidBoolean.first.destroy
|
20
|
-
assert record.valid?
|
21
|
-
ParanoidBoolean.only_deleted.first.destroy!
|
22
|
-
assert record.valid?
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_models_with_scoped_validations_can_be_multiply_deleted
|
27
|
-
model_a = ParanoidWithScopedValidation.create(name: "Model A", category: "Category A")
|
28
|
-
model_b = ParanoidWithScopedValidation.create(name: "Model B", category: "Category B")
|
29
|
-
|
30
|
-
ParanoidWithScopedValidation.delete([model_a.id, model_b.id])
|
31
|
-
|
32
|
-
assert_paranoid_deletion(model_a)
|
33
|
-
assert_paranoid_deletion(model_b)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_models_with_scoped_validations_can_be_multiply_destroyed
|
37
|
-
model_a = ParanoidWithScopedValidation.create(name: "Model A", category: "Category A")
|
38
|
-
model_b = ParanoidWithScopedValidation.create(name: "Model B", category: "Category B")
|
39
|
-
|
40
|
-
ParanoidWithScopedValidation.destroy([model_a.id, model_b.id])
|
41
|
-
|
42
|
-
assert_paranoid_deletion(model_a)
|
43
|
-
assert_paranoid_deletion(model_b)
|
44
|
-
end
|
45
|
-
end
|