require'spec_helper'requireRails.root.join('db','post_migrate','20170502101023_cleanup_namespaceless_pending_delete_projects.rb')describeCleanupNamespacelessPendingDeleteProjectsdobeforedo# Stub after_save callbacks that will fail when Project has no namespaceallow_any_instance_of(Project).toreceive(:ensure_dir_exist).and_return(nil)allow_any_instance_of(Project).toreceive(:update_project_statistics).and_return(nil)enddescribe'#up'doit'only cleans up pending delete projects'docreate(:empty_project)create(:empty_project,pending_delete: true)project=build(:empty_project,pending_delete: true,namespace_id: nil)project.save(validate: false)
described_class.new.upendit'does nothing when no pending delete projects without namespace found'docreate(:empty_project)create(:empty_project,pending_delete: true)expect(NamespacelessProjectDestroyWorker).not_toreceive(:bulk_perform_async)