diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/mailers/emails/projects_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/mailers/emails/projects_spec.rb')
-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..b9c71e35bc6 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_incident, :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) { {} } |