Commit ee20ecd3 authored by Sean Arnold's avatar Sean Arnold

Fix presenter specs

parent e606683f
......@@ -75,7 +75,7 @@ module AlertManagement
metadata << list_item('Monitoring tool', monitoring_tool) if monitoring_tool
metadata << list_item('Hosts', host_links) if hosts.any?
metadata << list_item('Description', description) if description.present?
metadata << list_item('GitLab Alert', details_url) if details_url.present?
metadata << list_item('GitLab alert', details_url) if details_url.present?
metadata.join(MARKDOWN_LINE_BREAK)
end
......
......@@ -107,7 +107,7 @@ module Projects
metadata << list_item(service.label.humanize, service.value) if service
metadata << list_item(monitoring_tool.label.humanize, monitoring_tool.value) if monitoring_tool
metadata << list_item(hosts.label.humanize, host_links) if hosts
metadata << list_item('GitLab Alert', details_url) if details_url
metadata << list_item('GitLab alert', details_url) if details_url
metadata.join(MARKDOWN_LINE_BREAK)
end
......
......@@ -293,6 +293,19 @@ RSpec.describe Projects::Prometheus::AlertPresenter do
end
end
describe '#details_url' do
subject { presenter.details_url }
it { is_expected.to eq(nil) }
context 'alert management alert present' do
let(:am_alert) { create(:alert_management_alert, project: project) }
let(:alert) { create(:alerting_alert, project: project, payload: payload, alert: am_alert) }
it { is_expected.to eq("http://localhost/#{project.full_path}/-/alert_management/#{am_alert.id}/details") }
end
end
context 'with gitlab alert' do
include_context 'gitlab alert'
......
......@@ -19,14 +19,14 @@ RSpec.describe IncidentManagement::ProcessAlertWorker do
allow(Gitlab::AppLogger).to receive(:warn).and_call_original
allow(IncidentManagement::CreateIssueService)
.to receive(:new).with(alert.project, parsed_payload)
.to receive(:new).with(alert.project, alert)
.and_call_original
end
shared_examples 'creates issue successfully' do
it 'creates an issue' do
expect(IncidentManagement::CreateIssueService)
.to receive(:new).with(alert.project, parsed_payload)
.to receive(:new).with(alert.project, alert)
expect { subject }.to change { Issue.count }.by(1)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment