From 213f46f188c29e9c442df61530110e172a7e819e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 11 Jan 2023 21:09:40 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/mailers/emails/imports_spec.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 spec/mailers/emails/imports_spec.rb (limited to 'spec/mailers') 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 -- cgit v1.2.3