diff options
author | Stan Hu <stanhu@gmail.com> | 2017-06-23 17:02:33 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-06-29 09:23:31 -0700 |
commit | fa93156528bca4306e040a1b73720b6411942fcf (patch) | |
tree | 863375c80f122d59ce57d31eb0f4605d3ea78474 /spec/models | |
parent | 5a983ac431affc800d5e9db9e83c14710ec29c36 (diff) | |
download | gitlab-ce-fa93156528bca4306e040a1b73720b6411942fcf.tar.gz |
Defer project destroys within a namespace in Groups::DestroyService#async_execute
Group#destroy would actually hard-delete all associated projects even
though the acts_as_paranoia gem is used, preventing Projects::DestroyService
from doing any work.
We first noticed this while trying to log all projects deletion to the Geo
log.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/namespace_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index d4f898f6d9f..62c4ea01ce1 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -342,6 +342,17 @@ describe Namespace, models: true do end end + describe '#soft_delete_without_removing_associations' do + let(:project1) { create(:project_empty_repo, namespace: namespace) } + + it 'updates the deleted_at timestamp but preserves projects' do + namespace.soft_delete_without_removing_associations + + expect(Project.all).to include(project1) + expect(namespace.deleted_at).not_to be_nil + end + end + describe '#user_ids_for_project_authorizations' do it 'returns the user IDs for which to refresh authorizations' do expect(namespace.user_ids_for_project_authorizations) |