summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-04-06 22:33:07 +0530
committerTimothy Andrew <mail@timothyandrew.net>2017-04-06 22:39:40 +0530
commit1c42505b026d922df50c59d5f9e85073b5f5345f (patch)
treeb94259c6aa9c4a6e2e24d00d91c4d548a7bd6953 /spec/support
parente152f3f3daf09b25e5a5952a0e62580b3ef96c50 (diff)
downloadgitlab-ce-1c42505b026d922df50c59d5f9e85073b5f5345f.tar.gz
Implement review comments from @DouweM for !10467.28695-move-all-associated-records-to-ghost-user
1. Have `MigrateToGhostUser` be a service rather than a mixed-in module, to keep things explicit. Specs testing the behavior of this class are moved into a separate service spec file. 2. Add a `user.reported_abuse_reports` association to make the `migrate_abuse_reports` method more consistent with the other `migrate_` methods.
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/services/migrate_to_ghost_user_service_shared_examples.rb (renamed from spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb)28
1 files changed, 4 insertions, 24 deletions
diff --git a/spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb
index 3820ffc283f..0eac587e973 100644
--- a/spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb
+++ b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class, options|
+shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class|
record_class_name = record_class.to_s.titleize.downcase
let(:project) { create(:project) }
@@ -13,13 +13,13 @@ shared_examples "migrating a deleted user's associated records to the ghost user
let!(:record) { created_record }
it "does not delete the #{record_class_name}" do
- service.execute(user)
+ service.execute
expect(record_class.find_by_id(record.id)).to be_present
end
it "migrates the #{record_class_name} so that the 'Ghost User' is the #{record_class_name} owner" do
- service.execute(user)
+ service.execute
migrated_record = record_class.find_by_id(record.id)
@@ -31,29 +31,9 @@ shared_examples "migrating a deleted user's associated records to the ghost user
end
it "blocks the user before migrating #{record_class_name}s to the 'Ghost User'" do
- service.execute(user)
+ service.execute
expect(user).to be_blocked
end
end
-
- unless options[:skip_assignee_specs]
- context "for a #{record_class_name} the user was assigned to" do
- let!(:record) { assigned_record }
-
- before do
- service.execute(user)
- end
-
- it "does not delete #{record_class_name}s the user is assigned to" do
- expect(record_class.find_by_id(record.id)).to be_present
- end
-
- it "migrates the #{record_class_name} so that it is 'Unassigned'" do
- migrated_record = record_class.find_by_id(record.id)
-
- expect(migrated_record.assignee).to be_nil
- end
- end
- end
end