Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paranoia
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paranoia
Commits
b36eb4d6
Commit
b36eb4d6
authored
Feb 15, 2017
by
Andrzej Piątyszek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepare tests
parent
c9728e18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
test/paranoia_test.rb
+32
-0
No files found.
test/paranoia_test.rb
View file @
b36eb4d6
...
...
@@ -564,6 +564,38 @@ class ParanoiaTest < test_framework
refute
c
.
paranoia_destroyed?
end
def
test_restore_with_associations_using_recovery_window
parent
=
ParentModel
.
create
first_child
=
parent
.
very_related_models
.
create
second_child
=
parent
.
very_related_models
.
create
parent
.
destroy
second_child
.
update
(
deleted_at:
parent
.
deleted_at
+
11
.
minutes
)
parent
.
restore!
(
:recursive
=>
true
)
assert_equal
true
,
parent
.
deleted_at
.
nil?
assert_equal
true
,
first_child
.
reload
.
deleted_at
.
nil?
assert_equal
true
,
second_child
.
reload
.
deleted_at
.
nil?
parent
.
destroy
second_child
.
update
(
deleted_at:
parent
.
deleted_at
+
11
.
minutes
)
parent
.
restore
(
:recursive
=>
true
,
:recovery_window
=>
10
.
minutes
)
assert_equal
true
,
parent
.
deleted_at
.
nil?
assert_equal
true
,
first_child
.
reload
.
deleted_at
.
nil?
assert_equal
false
,
second_child
.
reload
.
deleted_at
.
nil?
second_child
.
restore
parent
.
destroy
first_child
.
update
(
deleted_at:
parent
.
deleted_at
-
11
.
minutes
)
second_child
.
update
(
deleted_at:
parent
.
deleted_at
-
9
.
minutes
)
ParentModel
.
restore
(
parent
.
id
,
:recursive
=>
true
,
:recovery_window
=>
10
.
minutes
)
assert_equal
true
,
parent
.
reload
.
deleted_at
.
nil?
assert_equal
false
,
first_child
.
reload
.
deleted_at
.
nil?
assert_equal
true
,
second_child
.
reload
.
deleted_at
.
nil?
end
def
test_restore_with_associations
parent
=
ParentModel
.
create
first_child
=
parent
.
very_related_models
.
create
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment