diff options
author | Toon Claes <toon@iotcl.com> | 2017-08-16 15:46:26 +0300 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2017-08-22 15:29:54 +0300 |
commit | 2074f39a47645b5ea453adfba84247f2fcc4f3c7 (patch) | |
tree | 3f2aab56177cf0704faa8d739ce61acc7055a99e /spec/workers/namespaceless_project_destroy_worker_spec.rb | |
parent | ce89c425fe51d2317322350bbd8a364c08d97d21 (diff) |
Migration to remove pending delete projects with non-existing namespace
There might be some projects where the namespace was removed, but the
project wasn't. For these the projects still have a `namespace_id`
set. So this adds a post-deploy migration remove all projects that are
pending delete, and have a `namespace_id` that is non-existing.
Diffstat (limited to 'spec/workers/namespaceless_project_destroy_worker_spec.rb')
-rw-r--r-- | spec/workers/namespaceless_project_destroy_worker_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/workers/namespaceless_project_destroy_worker_spec.rb b/spec/workers/namespaceless_project_destroy_worker_spec.rb index 817e103fd9a..20cf580af8a 100644 --- a/spec/workers/namespaceless_project_destroy_worker_spec.rb +++ b/spec/workers/namespaceless_project_destroy_worker_spec.rb @@ -75,5 +75,19 @@ describe NamespacelessProjectDestroyWorker do end end end + + context 'project has non-existing namespace' do + let!(:project) do + project = build(:project, namespace_id: Namespace.maximum(:id).to_i.succ) + project.save(validate: false) + project + end + + it 'deletes the project' do + subject.perform(project.id) + + expect(Project.unscoped.all).not_to include(project) + end + end end end |