Commit ed14a065 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'issue_342492_7' into 'master'

Pass formats explicitly when rendering .md.erb

See merge request gitlab-org/gitlab!73420
parents 2f02dc07 3aede137
...@@ -46,8 +46,11 @@ module VulnerabilitiesHelper ...@@ -46,8 +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: 'vulnerabilities/jira_issue_description.md.erb', description = ApplicationController.render(
locals: { vulnerability: decorated_vulnerability }) template: 'vulnerabilities/jira_issue_description',
formats: :md,
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