acts_as_paranoid 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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