diff options
Diffstat (limited to 'spec/mailers/emails/pages_domains_spec.rb')
-rw-r--r-- | spec/mailers/emails/pages_domains_spec.rb | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/spec/mailers/emails/pages_domains_spec.rb b/spec/mailers/emails/pages_domains_spec.rb index 78887cef7ab..5029a17e4e5 100644 --- a/spec/mailers/emails/pages_domains_spec.rb +++ b/spec/mailers/emails/pages_domains_spec.rb @@ -23,13 +23,20 @@ describe Emails::PagesDomains do is_expected.to have_subject(email_subject) is_expected.to have_body_text(project.human_name) is_expected.to have_body_text(domain.domain) - is_expected.to have_body_text domain.url is_expected.to have_body_text project_pages_domain_url(project, domain) - is_expected.to have_body_text help_page_url('user/project/pages/custom_domains_ssl_tls_certification/index.md', anchor: link_anchor) end end end + shared_examples 'a pages domain verification email' do + it_behaves_like 'a pages domain email' + + it 'has the expected content' do + is_expected.to have_body_text domain.url + is_expected.to have_body_text help_page_url('user/project/pages/custom_domains_ssl_tls_certification/index.md', anchor: link_anchor) + end + end + shared_examples 'notification about upcoming domain removal' do context 'when domain is not scheduled for removal' do it 'asks user to remove it' do @@ -56,7 +63,7 @@ describe Emails::PagesDomains do subject { Notify.pages_domain_enabled_email(domain, user) } - it_behaves_like 'a pages domain email' + it_behaves_like 'a pages domain verification email' it { is_expected.to have_body_text 'has been enabled' } end @@ -67,7 +74,7 @@ describe Emails::PagesDomains do subject { Notify.pages_domain_disabled_email(domain, user) } - it_behaves_like 'a pages domain email' + it_behaves_like 'a pages domain verification email' it_behaves_like 'notification about upcoming domain removal' @@ -80,7 +87,7 @@ describe Emails::PagesDomains do subject { Notify.pages_domain_verification_succeeded_email(domain, user) } - it_behaves_like 'a pages domain email' + it_behaves_like 'a pages domain verification email' it { is_expected.to have_body_text 'successfully verified' } end @@ -94,10 +101,18 @@ describe Emails::PagesDomains do it_behaves_like 'a pages domain email' it_behaves_like 'notification about upcoming domain removal' + end + + describe '#pages_domain_auto_ssl_failed_email' do + let(:email_subject) { "#{project.path} | ACTION REQUIRED: Something went wrong while obtaining the Let's Encrypt certificate for GitLab Pages domain '#{domain.domain}'" } + + subject { Notify.pages_domain_auto_ssl_failed_email(domain, user) } + + it_behaves_like 'a pages domain email' - it 'says verification has failed and when the domain is enabled until' do - is_expected.to have_body_text 'Verification has failed' - is_expected.to have_body_text domain.enabled_until.strftime('%F %T') + it 'says that we failed to obtain certificate' do + is_expected.to have_body_text "Something went wrong while obtaining the Let's Encrypt certificate." + is_expected.to have_body_text help_page_url('user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md', anchor: 'troubleshooting') end end end |