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
348b1c72
Commit
348b1c72
authored
Apr 07, 2015
by
Nikolay Norkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests
parent
10f37a84
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
test/paranoia_test.rb
+16
-7
No files found.
test/paranoia_test.rb
View file @
348b1c72
...
...
@@ -451,6 +451,14 @@ class ParanoiaTest < test_framework
assert
RelatedModel
.
unscoped
.
exists?
(
child_2
.
id
)
end
def
test_really_destroy_behavior_for_callbacks
model
=
CallbackModel
.
new
model
.
save
model
.
really_destroy!
assert
model
.
instance_variable_get
(
:@real_destroy_callback_called
)
end
def
test_really_delete
model
=
ParanoidModel
.
new
model
.
save
...
...
@@ -843,15 +851,16 @@ end
class
CallbackModel
<
ActiveRecord
::
Base
acts_as_paranoid
before_destroy
{
|
model
|
model
.
instance_variable_set
:@destroy_callback_called
,
true
}
before_restore
{
|
model
|
model
.
instance_variable_set
:@restore_callback_called
,
true
}
before_update
{
|
model
|
model
.
instance_variable_set
:@update_callback_called
,
true
}
before_save
{
|
model
|
model
.
instance_variable_set
:@save_callback_called
,
true
}
before_destroy
{
|
model
|
model
.
instance_variable_set
:@destroy_callback_called
,
true
}
before_restore
{
|
model
|
model
.
instance_variable_set
:@restore_callback_called
,
true
}
before_update
{
|
model
|
model
.
instance_variable_set
:@update_callback_called
,
true
}
before_save
{
|
model
|
model
.
instance_variable_set
:@save_callback_called
,
true
}
before_real_destroy
{
|
model
|
model
.
instance_variable_set
:@real_destroy_callback_called
,
true
}
after_destroy
{
|
model
|
model
.
instance_variable_set
:@after_destroy_callback_called
,
true
}
after_commit
{
|
model
|
model
.
instance_variable_set
:@after_commit_callback_called
,
true
}
after_destroy
{
|
model
|
model
.
instance_variable_set
:@after_destroy_callback_called
,
true
}
after_commit
{
|
model
|
model
.
instance_variable_set
:@after_commit_callback_called
,
true
}
validate
{
|
model
|
model
.
instance_variable_set
:@validate_called
,
true
}
validate
{
|
model
|
model
.
instance_variable_set
:@validate_called
,
true
}
def
remove_called_variables
instance_variables
.
each
{
|
name
|
(
name
.
to_s
.
end_with?
(
'_called'
))
?
remove_instance_variable
(
name
)
:
nil
}
...
...
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