Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-04-06 13:06:36 +0300
committerTimothy Andrew <mail@timothyandrew.net>2017-04-06 16:29:17 +0300
commit3e1a1242c67781fb52940433c5ad1bbefd346216 (patch)
tree5f45e1f2dfee8ac69c0ee6340e2cc01ac5273817 /spec/support/services
parent682987547a932c011f84c6455f0fd32bb500b308 (diff)
Move a user's award emoji to the ghost user
... when the user is destroyed. 1. Normally, for a given awardable and award emoji name, a user is only allowed to create a single award emoji. 2. This validation needs to be removed for ghost users, since: - User A and User B have created award emoji - with the same name and against the same awardable - User A is deleted. Their award emoji is moved to the ghost user - User B is deleted. Their award emoji needs to be moved to the ghost user. However, this breaks the uniqueness validation, since the ghost user is only allowed to have one award emoji of a given name for a given awardable
Diffstat (limited to 'spec/support/services')
-rw-r--r--spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb b/spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb
index add3dd3d5bc..3820ffc283f 100644
--- a/spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb
+++ b/spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb
@@ -23,7 +23,11 @@ shared_examples "migrating a deleted user's associated records to the ghost user
migrated_record = record_class.find_by_id(record.id)
- expect(migrated_record.author).to eq(User.ghost)
+ if migrated_record.respond_to?(:author)
+ expect(migrated_record.author).to eq(User.ghost)
+ else
+ expect(migrated_record.send(author_alias)).to eq(User.ghost)
+ end
end
it "blocks the user before migrating #{record_class_name}s to the 'Ghost User'" do