Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
404b49a7
Commit
404b49a7
authored
Jun 18, 2018
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bring CE-EE parity to migrations/remove_soft_removed_objects_spec.rb
parent
f67eb5a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
spec/migrations/remove_soft_removed_objects_spec.rb
spec/migrations/remove_soft_removed_objects_spec.rb
+29
-7
No files found.
spec/migrations/remove_soft_removed_objects_spec.rb
View file @
404b49a7
...
@@ -3,6 +3,18 @@ require Rails.root.join('db', 'post_migrate', '20171207150343_remove_soft_remove
...
@@ -3,6 +3,18 @@ require Rails.root.join('db', 'post_migrate', '20171207150343_remove_soft_remove
describe
RemoveSoftRemovedObjects
,
:migration
do
describe
RemoveSoftRemovedObjects
,
:migration
do
describe
'#up'
do
describe
'#up'
do
let!
(
:groups
)
do
table
(
:namespaces
).
tap
do
|
t
|
t
.
inheritance_column
=
nil
end
end
let!
(
:routes
)
do
table
(
:routes
).
tap
do
|
t
|
t
.
inheritance_column
=
nil
end
end
it
'removes various soft removed objects'
do
it
'removes various soft removed objects'
do
5
.
times
do
5
.
times
do
create_with_deleted_at
(
:issue
)
create_with_deleted_at
(
:issue
)
...
@@ -28,19 +40,20 @@ describe RemoveSoftRemovedObjects, :migration do
...
@@ -28,19 +40,20 @@ describe RemoveSoftRemovedObjects, :migration do
it
'removes routes of soft removed personal namespaces'
do
it
'removes routes of soft removed personal namespaces'
do
namespace
=
create_with_deleted_at
(
:namespace
)
namespace
=
create_with_deleted_at
(
:namespace
)
group
=
create
(
:group
)
# rubocop:disable RSpec/FactoriesInMigrationSpecs
group
=
groups
.
create!
(
name:
'group'
,
path:
'group_path'
,
type:
'Group'
)
routes
.
create!
(
source_id:
group
.
id
,
source_type:
'Group'
,
name:
'group'
,
path:
'group_path'
)
expect
(
Route
.
where
(
source:
namespace
).
exists?
).
to
eq
(
true
)
expect
(
routes
.
where
(
source_id:
namespace
.
id
).
exists?
).
to
eq
(
true
)
expect
(
Route
.
where
(
source:
group
).
exists?
).
to
eq
(
true
)
expect
(
routes
.
where
(
source_id:
group
.
id
).
exists?
).
to
eq
(
true
)
run_migration
run_migration
expect
(
Route
.
where
(
source:
namespace
).
exists?
).
to
eq
(
false
)
expect
(
routes
.
where
(
source_id:
namespace
.
id
).
exists?
).
to
eq
(
false
)
expect
(
Route
.
where
(
source:
group
).
exists?
).
to
eq
(
true
)
expect
(
routes
.
where
(
source_id:
group
.
id
).
exists?
).
to
eq
(
true
)
end
end
it
'schedules the removal of soft removed groups'
do
it
'schedules the removal of soft removed groups'
do
group
=
create_
with_deleted_at
(
:group
)
group
=
create_
deleted_group
admin
=
create
(
:user
,
admin:
true
)
# rubocop:disable RSpec/FactoriesInMigrationSpecs
admin
=
create
(
:user
,
admin:
true
)
# rubocop:disable RSpec/FactoriesInMigrationSpecs
expect_any_instance_of
(
GroupDestroyWorker
)
expect_any_instance_of
(
GroupDestroyWorker
)
...
@@ -51,7 +64,7 @@ describe RemoveSoftRemovedObjects, :migration do
...
@@ -51,7 +64,7 @@ describe RemoveSoftRemovedObjects, :migration do
end
end
it
'does not remove soft removed groups when no admin user could be found'
do
it
'does not remove soft removed groups when no admin user could be found'
do
create_
with_deleted_at
(
:group
)
create_
deleted_group
expect_any_instance_of
(
GroupDestroyWorker
)
expect_any_instance_of
(
GroupDestroyWorker
)
.
not_to
receive
(
:perform
)
.
not_to
receive
(
:perform
)
...
@@ -74,4 +87,13 @@ describe RemoveSoftRemovedObjects, :migration do
...
@@ -74,4 +87,13 @@ describe RemoveSoftRemovedObjects, :migration do
row
row
end
end
def
create_deleted_group
group
=
groups
.
create!
(
name:
'group'
,
path:
'group_path'
,
type:
'Group'
)
routes
.
create!
(
source_id:
group
.
id
,
source_type:
'Group'
,
name:
'group'
,
path:
'group_path'
)
groups
.
where
(
id:
group
.
id
).
update_all
(
deleted_at:
1
.
year
.
ago
)
group
end
end
end
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