diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-30 00:10:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-30 00:10:10 +0300 |
commit | e4df6a7c53ab6e9dd6d63516ca9e0ad143cfa17a (patch) | |
tree | 7a4b5a3a99f19f8610df164e9e5cdd4a461d1465 /spec/mailers | |
parent | 13592f8455bfd17acd7cb10ccea015e3b63c155d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/projects_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/mailers/emails/projects_spec.rb b/spec/mailers/emails/projects_spec.rb index a5b89d16bc2..4855d5becfa 100644 --- a/spec/mailers/emails/projects_spec.rb +++ b/spec/mailers/emails/projects_spec.rb @@ -36,6 +36,27 @@ RSpec.describe Emails::Projects do Notify.prometheus_alert_fired_email(project, user, alert) end + it_behaves_like 'an email with X-GitLab headers containing project details' + + it 'has expected X-GitLab alert headers', :aggregate_failures do + is_expected.to have_header('X-GitLab-Alert-ID', /#{alert.id}/) + is_expected.to have_header('X-GitLab-Alert-IID', /#{alert.iid}/) + is_expected.to have_header('X-GitLab-NotificationReason', "alert_#{alert.state}") + + is_expected.not_to have_header('X-GitLab-Incident-ID', /.+/) + is_expected.not_to have_header('X-GitLab-Incident-IID', /.+/) + end + + context 'with incident' do + let(:alert) { create(:alert_management_alert, :with_issue, :from_payload, payload: payload, project: project) } + let(:incident) { alert.issue } + + it 'has expected X-GitLab incident headers', :aggregate_failures do + is_expected.to have_header('X-GitLab-Incident-ID', /#{incident.id}/) + is_expected.to have_header('X-GitLab-Incident-IID', /#{incident.iid}/) + end + end + context 'with empty payload' do let(:payload) { {} } |