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
test ordering of objects with same values in different order
Ivan Kuchine0b1cb617821
diff --git a/spec/models/queries/projects/project_query_custom_field_order_spec.rb b/spec/models/queries/projects/project_query_custom_field_order_spec.rbindex 5ac0873957c..e47e4fa9f05 100644--- a/spec/models/queries/projects/project_query_custom_field_order_spec.rb+++ b/spec/models/queries/projects/project_query_custom_field_order_spec.rb@@ -193,16 +193,28 @@ RSpec.describe ProjectQuery, "order using CustomFieldOrder" dolet(:projects) do[- project_with_cf_value(*id_by_value.fetch_values("100")),- project_with_cf_value(*id_by_value.fetch_values("3", "100")),- project_with_cf_value(*id_by_value.fetch_values("100", "3", "20")),- project_with_cf_value(*id_by_value.fetch_values("20", "100")),- project_with_cf_value(*id_by_value.fetch_values("3")),- project_with_cf_value(*id_by_value.fetch_values("3", "20")),- project_with_cf_value(*id_by_value.fetch_values("20")),+ project_with_cf_value(*id_by_value.fetch_values("100")), # 100+ project_with_cf_value(*id_by_value.fetch_values("3", "100")), # 100, 3+ project_with_cf_value(*id_by_value.fetch_values("3", "20", "100")), # 100, 3, 20+ project_with_cf_value(*id_by_value.fetch_values("3", "100", "20")), # 100, 3, 20+ project_with_cf_value(*id_by_value.fetch_values("20", "3", "100")), # 100, 3, 20+ project_with_cf_value(*id_by_value.fetch_values("20", "100", "3")), # 100, 3, 20+ project_with_cf_value(*id_by_value.fetch_values("100", "3", "20")), # 100, 3, 20+ project_with_cf_value(*id_by_value.fetch_values("100", "20", "3")), # 100, 3, 20+ project_with_cf_value(*id_by_value.fetch_values("20", "100")), # 100, 20+ project_with_cf_value(*id_by_value.fetch_values("3")), # 3+ project_with_cf_value(*id_by_value.fetch_values("3", "20")), # 3, 20+ project_with_cf_value(*id_by_value.fetch_values("20")), # 20project_without_cf_value # TODO: decide on order of absent values]end++ let(:projects_desc) do+ indexes = projects.each_index.to_a+ # order of values for a work package is ignored, so ordered by falling back on id asc+ indexes[2...8] = indexes[2...8].reverse+ projects.values_at(*indexes.reverse)+ endendendenddiff --git a/spec/models/query/results_cf_sorting_integration_spec.rb b/spec/models/query/results_cf_sorting_integration_spec.rbindex f7410b6d69c..7e2d0f1ec1f 100644--- a/spec/models/query/results_cf_sorting_integration_spec.rb+++ b/spec/models/query/results_cf_sorting_integration_spec.rb@@ -204,16 +204,28 @@ RSpec.describe Query::Results, "Sorting by custom field" dolet(:work_packages) do[- wp_with_cf_value(id_by_value.fetch_values("100")),- wp_with_cf_value(id_by_value.fetch_values("3", "100")),- wp_with_cf_value(id_by_value.fetch_values("100", "3", "20")),- wp_with_cf_value(id_by_value.fetch_values("20", "100")),- wp_with_cf_value(id_by_value.fetch_values("3")),- wp_with_cf_value(id_by_value.fetch_values("3", "20")),- wp_with_cf_value(id_by_value.fetch_values("20")),+ wp_with_cf_value(id_by_value.fetch_values("100")), # 100+ wp_with_cf_value(id_by_value.fetch_values("3", "100")), # 100, 3+ wp_with_cf_value(id_by_value.fetch_values("3", "20", "100")), # 100, 3, 20+ wp_with_cf_value(id_by_value.fetch_values("3", "100", "20")), # 100, 3, 20+ wp_with_cf_value(id_by_value.fetch_values("20", "3", "100")), # 100, 3, 20+ wp_with_cf_value(id_by_value.fetch_values("20", "100", "3")), # 100, 3, 20+ wp_with_cf_value(id_by_value.fetch_values("100", "3", "20")), # 100, 3, 20+ wp_with_cf_value(id_by_value.fetch_values("100", "20", "3")), # 100, 3, 20+ wp_with_cf_value(id_by_value.fetch_values("20", "100")), # 100, 20+ wp_with_cf_value(id_by_value.fetch_values("3")), # 3+ wp_with_cf_value(id_by_value.fetch_values("3", "20")), # 3, 20+ wp_with_cf_value(id_by_value.fetch_values("20")), # 20wp_without_cf_value # TODO: decide on order of absent values]end++ let(:work_packages_desc) do+ indexes = work_packages.each_index.to_a+ # order of values for a project is ignored, so ordered by falling back on id asc+ indexes[2...8] = indexes[2...8].reverse+ work_packages.values_at(*indexes.reverse)+ endendendend