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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
b0668b34
Commit
b0668b34
authored
Mar 12, 2019
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove factories from projects cleanup spec
parent
853054e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
spec/migrations/cleanup_nonexisting_namespace_pending_delete_projects_spec.rb
...nup_nonexisting_namespace_pending_delete_projects_spec.rb
+8
-11
No files found.
spec/migrations/cleanup_nonexisting_namespace_pending_delete_projects_spec.rb
View file @
b0668b34
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20170816102555_cleanup_nonexisting_namespace_pending_delete_projects.rb'
)
describe
CleanupNonexistingNamespacePendingDeleteProjects
do
before
do
# Stub after_save callbacks that will fail when Project has invalid namespace
allow_any_instance_of
(
Project
).
to
receive
(
:ensure_storage_path_exist
).
and_return
(
nil
)
allow_any_instance_of
(
Project
).
to
receive
(
:update_project_statistics
).
and_return
(
nil
)
end
describe
CleanupNonexistingNamespacePendingDeleteProjects
,
:migration
do
let
(
:projects
)
{
table
(
:projects
)
}
let
(
:namespaces
)
{
table
(
:namespaces
)
}
describe
'#up'
do
set
(
:some_project
)
{
create
(
:project
)
}
# rubocop:disable RSpec/FactoriesInMigrationSpecs
let!
(
:some_project
)
{
projects
.
create!
}
let
(
:namespace
)
{
namespaces
.
create!
(
name:
'test'
,
path:
'test'
)
}
it
'only cleans up when namespace does not exist'
do
create
(
:project
,
pending_delete:
true
)
# rubocop:disable RSpec/FactoriesInMigrationSpecs
project
=
build
(
:project
,
pending_delete:
true
,
namespace:
nil
,
namespace_id:
Namespace
.
maximum
(
:id
).
to_i
.
succ
)
# rubocop:disable RSpec/FactoriesInMigrationSpecs
project
.
save
(
validate:
false
)
projects
.
create!
(
pending_delete:
true
,
namespace_id:
namespace
.
id
)
project
=
projects
.
create!
(
pending_delete:
true
,
namespace_id:
0
)
expect
(
NamespacelessProjectDestroyWorker
).
to
receive
(
:bulk_perform_async
).
with
([[
project
.
id
]])
...
...
@@ -22,7 +19,7 @@ describe CleanupNonexistingNamespacePendingDeleteProjects do
end
it
'does nothing when no pending delete projects without namespace found'
do
create
(
:project
,
pending_delete:
true
,
namespace:
create
(
:namespace
))
# rubocop:disable RSpec/FactoriesInMigrationSpecs
projects
.
create!
(
pending_delete:
true
,
namespace_id:
namespace
.
id
)
expect
(
NamespacelessProjectDestroyWorker
).
not_to
receive
(
:bulk_perform_async
)
...
...
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