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

Simplify rendering JIRA issue description

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