Split tests for project snippet migration to ghost user

parent 168c5a2e
Pipeline #140016666 failed with stages
......@@ -42,12 +42,10 @@ describe Users::DestroyService do
it 'calls the bulk snippet destroy service for the user personal snippets' do
repo1 = create(:personal_snippet, :repository, author: user).snippet_repository
repo2 = create(:project_snippet, :repository, author: user).snippet_repository
repo3 = create(:project_snippet, :repository, project: project, author: user).snippet_repository
aggregate_failures do
expect(gitlab_shell.repository_exists?(repo1.shard_name, repo1.disk_path + '.git')).to be_truthy
expect(gitlab_shell.repository_exists?(repo2.shard_name, repo2.disk_path + '.git')).to be_truthy
expect(gitlab_shell.repository_exists?(repo3.shard_name, repo3.disk_path + '.git')).to be_truthy
end
......@@ -65,11 +63,17 @@ describe Users::DestroyService do
aggregate_failures do
expect(gitlab_shell.repository_exists?(repo1.shard_name, repo1.disk_path + '.git')).to be_falsey
expect(gitlab_shell.repository_exists?(repo2.shard_name, repo2.disk_path + '.git')).to be_truthy
expect(gitlab_shell.repository_exists?(repo3.shard_name, repo3.disk_path + '.git')).to be_falsey
end
end
it 'does not delete project snippets that the user is the author of' do
repo2 = create(:project_snippet, :repository, author: user).snippet_repository
service.execute(user)
expect(gitlab_shell.repository_exists?(repo2.shard_name, repo2.disk_path + '.git')).to be_truthy
expect(User.ghost.snippets).to include(repo2.snippet)
end
context 'when an error is raised deleting snippets' do
it 'does not delete user' do
snippet = create(:personal_snippet, :repository, author: user)
......
......@@ -76,11 +76,11 @@ describe Users::MigrateToGhostUserService do
end
end
end
end
context 'snippets' do
include_examples "migrating a deleted user's associated records to the ghost user", Snippet do
let(:created_record) { create(:snippet, project: project, author: user) }
end
context 'snippets' do
include_examples "migrating a deleted user's associated records to the ghost user", Snippet do
let(:created_record) { create(:snippet, project: project, author: user) }
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment