Commit 3aede137 authored by Peter Leitzen's avatar Peter Leitzen

Simplify rendering JIRA issue description

parent 4a307a69
......@@ -46,12 +46,11 @@ module VulnerabilitiesHelper
decorated_vulnerability = vulnerability.present
summary = _('Investigate vulnerability: %{title}') % { title: decorated_vulnerability.title }
description = ApplicationController.render(template: {
partial: 'vulnerabilities/jira_issue_description',
description = ApplicationController.render(
template: 'vulnerabilities/jira_issue_description',
formats: :md,
handlers: :erb
},
locals: { vulnerability: decorated_vulnerability })
locals: { vulnerability: decorated_vulnerability }
)
vulnerability.project.jira_integration.new_issue_url_with_predefined_fields(summary, description)
end
......
......@@ -225,12 +225,6 @@ RSpec.describe VulnerabilitiesHelper do
JIRA
end
it 'renders description using dedicated template' do
expect(ApplicationController).to receive(:render).with(template: 'vulnerabilities/jira_issue_description.md.erb', locals: { vulnerability: an_instance_of(VulnerabilityPresenter) })
subject
end
it 'delegates rendering URL to Integrations::Jira' do
expect(jira_integration).to receive(:new_issue_url_with_predefined_fields).with("Investigate vulnerability: #{vulnerability.title}", expected_jira_issue_description)
......@@ -247,8 +241,9 @@ RSpec.describe VulnerabilitiesHelper do
end
it 'renders description using dedicated template without raising error' do
expect(ApplicationController).to receive(:render).with(template: 'vulnerabilities/jira_issue_description.md.erb', locals: { vulnerability: an_instance_of(VulnerabilityPresenter) })
expect {subject}.not_to raise_error
expect(jira_integration).to receive(:new_issue_url_with_predefined_fields).with("Investigate vulnerability: #{vulnerability.title}", expected_jira_issue_description)
subject
end
end
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