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:
Diffstat (limited to 'spec/lib/gitlab/background_migration/populate_issue_email_participants_spec.rb')
-rw-r--r--spec/lib/gitlab/background_migration/populate_issue_email_participants_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration/populate_issue_email_participants_spec.rb b/spec/lib/gitlab/background_migration/populate_issue_email_participants_spec.rb
new file mode 100644
index 00000000000..f724b007e01
--- /dev/null
+++ b/spec/lib/gitlab/background_migration/populate_issue_email_participants_spec.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::BackgroundMigration::PopulateIssueEmailParticipants, schema: 20201128210234 do
+ let!(:namespace) { table(:namespaces).create!(name: 'namespace', path: 'namespace') }
+ let!(:project) { table(:projects).create!(id: 1, namespace_id: namespace.id) }
+ let!(:issue1) { table(:issues).create!(id: 1, project_id: project.id, service_desk_reply_to: "a@gitlab.com") }
+ let!(:issue2) { table(:issues).create!(id: 2, project_id: project.id, service_desk_reply_to: "b@gitlab.com") }
+ let(:issue_email_participants) { table(:issue_email_participants) }
+
+ describe '#perform' do
+ it 'migrates email addresses from service desk issues', :aggregate_failures do
+ expect { subject.perform(1, 2) }.to change { issue_email_participants.count }.by(2)
+
+ expect(issue_email_participants.find_by(issue_id: 1).email).to eq("a@gitlab.com")
+ expect(issue_email_participants.find_by(issue_id: 2).email).to eq("b@gitlab.com")
+ end
+ end
+end