diff options
Diffstat (limited to 'spec/mailers/emails/service_desk_spec.rb')
-rw-r--r-- | spec/mailers/emails/service_desk_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/mailers/emails/service_desk_spec.rb b/spec/mailers/emails/service_desk_spec.rb index e76da38998b..76036fcd0b3 100644 --- a/spec/mailers/emails/service_desk_spec.rb +++ b/spec/mailers/emails/service_desk_spec.rb @@ -102,6 +102,19 @@ RSpec.describe Emails::ServiceDesk, feature_category: :service_desk do end end + shared_examples 'a custom email verification process result email with error' do |error_identifier, expected_text| + context "when having #{error_identifier} error" do + before do + service_desk_setting.custom_email_verification.error = error_identifier + end + + it 'contains correct error message headline in text part' do + # look for text part because we can ignore HTML tags then + expect(subject.text_part.body).to match(expected_text) + end + end + end + describe '.service_desk_thank_you_email' do let_it_be(:reply_in_subject) { true } let_it_be(:default_text) do @@ -364,4 +377,21 @@ RSpec.describe Emails::ServiceDesk, feature_category: :service_desk do is_expected.to have_body_text("@#{user.username}") end end + + describe '.service_desk_verification_result_email' do + before do + service_desk_setting.custom_email_verification.triggerer = user + end + + subject { Notify.service_desk_verification_result_email(service_desk_setting, 'owner@example.com') } + + it_behaves_like 'an email sent from GitLab' + it_behaves_like 'a custom email verification process email' + it_behaves_like 'a custom email verification process notification email' + it_behaves_like 'a custom email verification process result email with error', 'smtp_host_issue', 'SMTP host issue' + it_behaves_like 'a custom email verification process result email with error', 'invalid_credentials', 'Invalid credentials' + it_behaves_like 'a custom email verification process result email with error', 'mail_not_received_within_timeframe', 'Verification email not received within timeframe' + it_behaves_like 'a custom email verification process result email with error', 'incorrect_from', 'Incorrect From header' + it_behaves_like 'a custom email verification process result email with error', 'incorrect_token', 'Incorrect verification token' + end end |