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
add test for unsupported formatted Custom Field
as-opd75e6a50b6d8
diff --git a/spec/models/work_package/pdf_export/common/macro_spec.rb b/spec/models/work_package/pdf_export/common/macro_spec.rbindex 427c7fad596..58f95d56c73 100644--- a/spec/models/work_package/pdf_export/common/macro_spec.rb+++ b/spec/models/work_package/pdf_export/common/macro_spec.rb@@ -40,6 +40,15 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dotypes: [type_task])end+ shared_let(:formatted_custom_field) do+ create(+ :work_package_custom_field,+ name: "Custom Formatted Field",+ field_format: "text",+ is_for_all: true,+ types: [type_task]+ )+ endshared_let(:project_custom_field_section) { create(:project_custom_field_section) }shared_let(:project_custom_field) docreate(:string_project_custom_field, name: "Project Custom Field 1", project_custom_field_section:)@@ -48,7 +57,7 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro docreate(:project,status_code: "on_track",- work_package_custom_fields: [custom_field],+ work_package_custom_fields: [custom_field, formatted_custom_field],project_custom_fields: [project_custom_field],custom_field_values: { project_custom_field.id => "Project custom value 1" })@@ -59,7 +68,10 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dosubject: "Work package 1",type: type_task,status: create(:status, name: "In Progress"), project: project,- custom_field_values: { custom_field.id => "Custom value 1" }+ custom_field_values: {+ custom_field.id => "Custom value 1",+ formatted_custom_field.id => "**Formatted** _text_ content"+ })endshared_let(:formatter) { Class.new { extend WorkPackage::PDFExport::Common::Macro } }@@ -234,6 +246,22 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro doendend+ describe "with formatted custom field" do+ let(:markdown) { 'workPackageValue:"Custom Formatted Field"' }++ it "outputs an error message for rich text" do+ expect(formatted).to include(I18n.t("export.macro.rich_text_unsupported"))+ end+ end++ describe "with specific work package ID and formatted custom field" do+ let(:markdown) { "workPackageValue:#{work_package.id}:\"Custom Formatted Field\"" }++ it "outputs an error message for rich text" do+ expect(formatted).to include(I18n.t("export.macro.rich_text_unsupported"))+ end+ end+describe "with non-existent attribute" dolet(:markdown) { "workPackageValue:nonexistent_attribute" }