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
6d90b426
Commit
6d90b426
authored
Feb 01, 2016
by
Weston Ganger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added without_default_scope option
parent
90471cdb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
test/paranoia_test.rb
+5
-3
No files found.
test/paranoia_test.rb
View file @
6d90b426
...
@@ -40,7 +40,8 @@ def setup!
...
@@ -40,7 +40,8 @@ def setup!
'namespaced_paranoid_belongs_tos'
=>
'deleted_at DATETIME, paranoid_has_one_id INTEGER'
,
'namespaced_paranoid_belongs_tos'
=>
'deleted_at DATETIME, paranoid_has_one_id INTEGER'
,
'unparanoid_unique_models'
=>
'name VARCHAR(32), paranoid_with_unparanoids_id INTEGER'
,
'unparanoid_unique_models'
=>
'name VARCHAR(32), paranoid_with_unparanoids_id INTEGER'
,
'active_column_models'
=>
'deleted_at DATETIME, active BOOLEAN'
,
'active_column_models'
=>
'deleted_at DATETIME, active BOOLEAN'
,
'active_column_model_with_uniqueness_validations'
=>
'name VARCHAR(32), deleted_at DATETIME, active BOOLEAN'
'active_column_model_with_uniqueness_validations'
=>
'name VARCHAR(32), deleted_at DATETIME, active BOOLEAN'
,
'without_default_scope_models'
=>
'deleted_at DATETIME'
}.
each
do
|
table_name
,
columns_as_sql_string
|
}.
each
do
|
table_name
,
columns_as_sql_string
|
ActiveRecord
::
Base
.
connection
.
execute
"CREATE TABLE
#{
table_name
}
(id INTEGER NOT NULL PRIMARY KEY,
#{
columns_as_sql_string
}
)"
ActiveRecord
::
Base
.
connection
.
execute
"CREATE TABLE
#{
table_name
}
(id INTEGER NOT NULL PRIMARY KEY,
#{
columns_as_sql_string
}
)"
end
end
...
@@ -205,10 +206,11 @@ class ParanoiaTest < test_framework
...
@@ -205,10 +206,11 @@ class ParanoiaTest < test_framework
end
end
def
test_without_default_scope_option
def
test_without_default_scope_option
model
=
WithoutDefaultScopeModel
.
create!
(
name:
"A"
,
deleted_at:
Time
.
now
)
model
=
WithoutDefaultScopeModel
.
create
model
.
destroy
assert_equal
1
,
model
.
class
.
count
assert_equal
1
,
model
.
class
.
count
assert_equal
1
,
model
.
class
.
only_deleted
.
count
assert_equal
1
,
model
.
class
.
only_deleted
.
count
assert_equal
0
,
model
.
class
.
w
ithout_deleted
.
count
assert_equal
0
,
model
.
class
.
w
here
(
deleted_at:
nil
)
.
count
end
end
def
test_active_column_model
def
test_active_column_model
...
...
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