diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2018-12-06 08:51:30 +0800 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2019-01-07 11:16:58 +0800 |
commit | 3c026971149c95f076b8c50a52ddbfed139d5b20 (patch) | |
tree | 6bf0e1e8e28968887156dd524dc37e498229a9e6 /spec/mailers | |
parent | 876ab436fabf2f44e2a6912262f980256b7c9736 (diff) | |
download | gitlab-ce-3c026971149c95f076b8c50a52ddbfed139d5b20.tar.gz |
Import CSV Backend
Process CSV uploads async using a worker then email results
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/issues_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/mailers/emails/issues_spec.rb b/spec/mailers/emails/issues_spec.rb new file mode 100644 index 00000000000..68c87803b78 --- /dev/null +++ b/spec/mailers/emails/issues_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' +require 'email_spec' + +describe Emails::Issues do + include EmailSpec::Matchers + + describe "#import_issues_csv_email" do + let(:user) { create(:user) } + let(:project) { create(:project) } + + subject { Notify.import_issues_csv_email(user.id, project.id, @results) } + + it "shows number of successful issues imported" do + @results = { success: 165, errors: [], valid_file: true } + + expect(subject).to have_body_text "165 issues imported" + end + + it "shows error when file is invalid" do + @results = { success: 0, errors: [], valid_file: false } + + expect(subject).to have_body_text "Error parsing CSV" + end + + it "shows line numbers with errors" do + @results = { success: 0, errors: [23, 34, 58], valid_file: false } + + expect(subject).to have_body_text "23, 34, 58" + end + end +end |