Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
404b49a7
Unverified
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
Hide 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 @@
describe
RemoveSoftRemovedObjects
,
:migration
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
5
.
times
do
create_with_deleted_at
(
:issue
)
...
...
@@ -28,19 +40,20 @@
it
'removes routes of soft removed personal namespaces'
do
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
(
R
oute
.
where
(
source:
namespace
).
exists?
).
to
eq
(
true
)
expect
(
R
oute
.
where
(
source:
group
).
exists?
).
to
eq
(
true
)
expect
(
r
oute
s
.
where
(
source
_id
:
namespace
.
id
).
exists?
).
to
eq
(
true
)
expect
(
r
oute
s
.
where
(
source
_id
:
group
.
id
).
exists?
).
to
eq
(
true
)
run_migration
expect
(
R
oute
.
where
(
source:
namespace
).
exists?
).
to
eq
(
false
)
expect
(
R
oute
.
where
(
source:
group
).
exists?
).
to
eq
(
true
)
expect
(
r
oute
s
.
where
(
source
_id
:
namespace
.
id
).
exists?
).
to
eq
(
false
)
expect
(
r
oute
s
.
where
(
source
_id
:
group
.
id
).
exists?
).
to
eq
(
true
)
end
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
expect_any_instance_of
(
GroupDestroyWorker
)
...
...
@@ -51,7 +64,7 @@
end
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
)
.
not_to
receive
(
:perform
)
...
...
@@ -74,4 +87,13 @@ def create_with_deleted_at(*args)
row
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
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