OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
spec: test with long text custom field in single pdf export
as-opeecd49504b89
diff --git a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rbindex f384afcb8b4..963dbab97c2 100644--- a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb+++ b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb@@ -31,8 +31,17 @@ require 'spec_helper'RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doinclude Redmine::I18ninclude PDFExportSpecUtils- let(:type) { create(:type_bug) }- let(:project) { create(:project, name: 'Foo Bla. Report No. 4/2021 with/for Case 42', types: [type]) }+ let(:type) do+ create(:type_bug, custom_fields: [long_text_custom_field]).tap do |t|+ t.attribute_groups.first.attributes.push(long_text_custom_field.attribute_name)+ end+ end+ let(:project) do+ create(:project,+ name: 'Foo Bla. Report No. 4/2021 with/for Case 42',+ types: [type],+ work_package_custom_fields: [long_text_custom_field])+ endlet(:user) docreate(:user,member_in_project: project,@@ -43,6 +52,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dolet(:image_path) { Rails.root.join("spec/fixtures/files/image.png") }let(:image_attachment) { Attachment.new author: user, file: File.open(image_path) }let(:attachments) { [image_attachment] }+ let(:long_text_custom_field) { create(:issue_custom_field, :text, name: 'LongText') }let(:work_package) dodescription = <<~DESCRIPTION**Lorem** _ipsum_ ~~dolor~~ `sit` [amet](https://example.com/), consetetur sadipscing elitr.@@ -63,7 +73,8 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dotype:,subject: 'Work package 1',story_points: 1,- description:).tap do |wp|+ description:,+ custom_values: { long_text_custom_field.id => 'foo' }).tap do |wp|allow(wp).to receive(:attachments).and_return attachments@@ -115,7 +126,9 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do'amet', ', consetetur sadipscing elitr.', ' ', '@OpenProject Admin','Image Caption','Foo',- '1', export_time_formatted, project.name+ '1', export_time_formatted, project.name,+ 'LongText', 'foo',+ '2', export_time_formatted, project.name].join(' '))expect(pdf[:images].length).to eq(2)end