diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-04-05 10:20:53 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-04-06 16:28:57 +0300 |
commit | 72580f07af5a2c1e4df6bbc339ad804b5f5bb9ed (patch) | |
tree | a80a44687563e69aab8636c03c62e7d5e9b95230 /spec/services | |
parent | fa65b65b0f5e7095e2ec7c4ca0c269a4fe4baab1 (diff) |
Move a user's merge requests to the ghost user.
1. When the user is deleted.
2. Refactor out code relating to "migrating records to the ghost user" into a
`MigrateToGhostUser` concern, which is tested using a shared example.
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/users/destroy_service_spec.rb (renamed from spec/services/users/destroy_spec.rb) | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/services/users/destroy_spec.rb b/spec/services/users/destroy_service_spec.rb index 66c61b7f8ff..a5b69e6ddf4 100644 --- a/spec/services/users/destroy_spec.rb +++ b/spec/services/users/destroy_service_spec.rb @@ -141,5 +141,21 @@ describe Users::DestroyService, services: true do expect(User.exists?(user.id)).to be(false) end end + + context 'migrating associated records to the ghost user' do + context 'issues' do + include_examples "migrating a deleted user's associated records to the ghost user", Issue do + let(:created_record) { create(:issue, project: project, author: user) } + let(:assigned_record) { create(:issue, project: project, assignee: user) } + end + end + + context 'merge requests' do + include_examples "migrating a deleted user's associated records to the ghost user", MergeRequest do + let(:created_record) { create(:merge_request, source_project: project, author: user, target_branch: "first") } + let(:assigned_record) { create(:merge_request, source_project: project, assignee: user, target_branch: 'second') } + end + end + end end end |