diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-04-05 13:27:46 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-04-06 18:58:59 +0530 |
commit | 97cbf7c223ec772e4747bab5083904d4053e2e63 (patch) | |
tree | e956aac6644a42485095939f3b11aaa59a40b5b5 /spec/support/services | |
parent | 72580f07af5a2c1e4df6bbc339ad804b5f5bb9ed (diff) | |
download | gitlab-ce-97cbf7c223ec772e4747bab5083904d4053e2e63.tar.gz |
Move a user's notes to the ghost user
... when the user is destroyed.
Diffstat (limited to 'spec/support/services')
-rw-r--r-- | spec/support/services/user_destroy_service_migrate_to_ghost_user_shared_examples.rb | 26 |
1 files changed, 14 insertions, 12 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 8996e3420e6..add3dd3d5bc 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 @@ -1,6 +1,6 @@ require "spec_helper" -shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class| +shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class, options| record_class_name = record_class.to_s.titleize.downcase let(:project) { create(:project) } @@ -33,21 +33,23 @@ shared_examples "migrating a deleted user's associated records to the ghost user end end - context "for a #{record_class_name} the user was assigned to" do - let!(:record) { assigned_record } + 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 + 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 "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) + 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 + expect(migrated_record.assignee).to be_nil + end end end end |