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
remove rescue I18n::MissingTranslationData as it's thrown in dev & test; but disable it for the tests it would be thrown
as-opc1c7dc127f8e
diff --git a/app/models/work_package/exports/macros/attributes.rb b/app/models/work_package/exports/macros/attributes.rbindex 32be596fdd3..8c73907f0f4 100644--- a/app/models/work_package/exports/macros/attributes.rb+++ b/app/models/work_package/exports/macros/attributes.rb@@ -105,10 +105,6 @@ module WorkPackage::Exportsmodel.human_attribute_name(::API::Utilities::PropertyNameConverter.to_ar_name(attribute.to_sym, context: model.new))- rescue I18n::MissingTranslationData- # If the translation is missing, we return the attribute name as a fallback- # # This can happen if the attribute is a custom field, the attribute is not translated or does not exist- attribute.to_senddef self.resolve_work_package_match(id, type, attribute, user)diff --git a/spec/models/work_package/pdf_export/common/macro_spec.rb b/spec/models/work_package/pdf_export/common/macro_spec.rbindex a96e151730d..a6b1c7543b2 100644--- a/spec/models/work_package/pdf_export/common/macro_spec.rb+++ b/spec/models/work_package/pdf_export/common/macro_spec.rb@@ -252,6 +252,16 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro doenddescribe "workPackageLabel macro" do+ let!(:original_setting) { ActiveModel::Translation.raise_on_missing_translations }++ before do+ ActiveModel::Translation.raise_on_missing_translations = false+ end++ after do+ ActiveModel::Translation.raise_on_missing_translations = original_setting+ end+describe "with current work package attribute" dolet(:markdown) { "workPackageLabel:subject" }@@ -288,7 +298,7 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dolet(:markdown) { "workPackageLabel:\"Custom Field 1\"" }it "outputs the custom field name" do- expect(formatted).to eq("Custom Field 1")+ expect(formatted).to eq("Custom field 1")endend@@ -296,7 +306,7 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dolet(:markdown) { "workPackageLabel:185:\"Custom Field 1\"" }it "outputs the custom field name for the specified work package" do- expect(formatted).to eq("Custom Field 1")+ expect(formatted).to eq("Custom field 1")endend@@ -304,7 +314,7 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dolet(:markdown) { "workPackageLabel:nonexistent_attribute" }it "outputs the humanized attribute name" do- expect(formatted).to eq("nonexistent_attribute")+ expect(formatted).to eq("Nonexistent attribute")endend@@ -408,6 +418,16 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro doenddescribe "projectLabel macro" do+ let!(:original_setting) { ActiveModel::Translation.raise_on_missing_translations }++ before do+ ActiveModel::Translation.raise_on_missing_translations = false+ end++ after do+ ActiveModel::Translation.raise_on_missing_translations = original_setting+ end+describe "with current project attribute" dolet(:markdown) { "projectLabel:name" }@@ -452,7 +472,7 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dolet(:markdown) { "projectLabel:\"Project Custom Field 1\"" }it "outputs the custom field name" do- expect(formatted).to eq("Project Custom Field 1")+ expect(formatted).to eq("Project custom field 1")endend@@ -460,7 +480,7 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dolet(:markdown) { "projectLabel:#{project.id}:\"Project Custom Field 1\"" }it "outputs the custom field name for the specified project" do- expect(formatted).to eq("Project Custom Field 1")+ expect(formatted).to eq("Project custom field 1")endend@@ -468,7 +488,7 @@ RSpec.describe WorkPackage::PDFExport::Common::Macro dolet(:markdown) { "projectLabel:nonexistent_attribute" }it "outputs the humanized attribute name" do- expect(formatted).to eq("nonexistent_attribute")+ expect(formatted).to eq("Nonexistent attribute")endend