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
[#61315] fix tokens for work packages
Eric Schubert16e76016114d
diff --git a/app/models/types/patterns/token_property_mapper.rb b/app/models/types/patterns/token_property_mapper.rbindex 171c17076e2..fe9e3bb6086 100644--- a/app/models/types/patterns/token_property_mapper.rb+++ b/app/models/types/patterns/token_property_mapper.rb@@ -103,7 +103,7 @@ module Typesenddef work_package_cfs_for(type)- all_work_package_cfs.where(type: type)+ all_work_package_cfs.merge(type.custom_fields)enddef all_work_package_cfsdiff --git a/spec/models/types/patterns/token_property_mapper_spec.rb b/spec/models/types/patterns/token_property_mapper_spec.rbindex 390dcfc975a..35b3031c0cc 100644--- a/spec/models/types/patterns/token_property_mapper_spec.rb+++ b/spec/models/types/patterns/token_property_mapper_spec.rb@@ -41,9 +41,19 @@ RSpec.describe Types::Patterns::TokenPropertyMapper doshared_let(:work_package_parent) docreate(:work_package, project:, category:, start_date: Date.yesterday, estimated_hours: 120, due_date: 3.months.from_now)end+shared_let(:work_package) do- create(:work_package, responsible:, project:, category:, due_date: 1.month.from_now,- assigned_to: assignee, parent: work_package_parent, start_date: Time.zone.today, estimated_hours: 30)+ create(:work_package, responsible:, project:, category:, due_date: 1.month.from_now, assigned_to: assignee,+ parent: work_package_parent, start_date: Time.zone.today, estimated_hours: 30)+ end++ shared_let(:string_custom_field) do+ create(:string_wp_custom_field).tap do |custom_field|+ project.work_package_custom_fields << custom_field+ work_package.type.custom_fields << custom_field++ create(:work_package_custom_value, custom_field:, customized: work_package, value: "test")+ endenddescribed_class::TOKEN_PROPERTY_MAP.each_pair do |key, details|@@ -54,9 +64,11 @@ RSpec.describe Types::Patterns::TokenPropertyMapper doendit "returns all possible tokens" do+ cf = string_custom_fieldtokens = described_class.new.tokens_for_type(work_package.type)expect(tokens.keys).to match_array(%i[work_package project parent])expect(tokens[:project][:project_status]).to eq(Project.human_attribute_name(:status_code))+ expect(tokens[:work_package][:"custom_field_#{cf.id}"]).to eq(cf.name)endend