summaryrefslogtreecommitdiff
path: root/spec/mailers/emails/imports_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/mailers/emails/imports_spec.rb
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
downloadgitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/mailers/emails/imports_spec.rb')
-rw-r--r--spec/mailers/emails/imports_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/mailers/emails/imports_spec.rb b/spec/mailers/emails/imports_spec.rb
new file mode 100644
index 00000000000..039113d3098
--- /dev/null
+++ b/spec/mailers/emails/imports_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require 'email_spec'
+
+RSpec.describe Emails::Imports, feature_category: :importers do
+ include EmailSpec::Matchers
+
+ let(:errors) { { 'gist_id1' => "Title can't be blank", 'gist_id2' => 'Snippet maximum file count exceeded' } }
+ let(:user) { build_stubbed(:user) }
+
+ describe '#github_gists_import_errors_email' do
+ subject { Notify.github_gists_import_errors_email('user_id', errors) }
+
+ before do
+ allow(User).to receive(:find).and_return(user)
+ end
+
+ it 'sends success email' do
+ expect(subject).to have_subject('GitHub Gists import finished with errors')
+ expect(subject).to have_content('GitHub gists that were not imported:')
+ expect(subject).to have_content("Gist with id gist_id1 failed due to error: Title can't be blank.")
+ expect(subject).to have_content('Gist with id gist_id2 failed due to error: Snippet maximum file count exceeded.')
+ end
+
+ it_behaves_like 'appearance header and footer enabled'
+ it_behaves_like 'appearance header and footer not enabled'
+ end
+end