Skip to content

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

add wp_without_cf_value helper

Ivan Kuchin89e1a347e601
diff --git a/spec/models/query/results_cf_sorting_integration_spec.rb b/spec/models/query/results_cf_sorting_integration_spec.rb
index 7957b1b85a9..1f992fb74a1 100644
--- a/spec/models/query/results_cf_sorting_integration_spec.rb
+++ b/spec/models/query/results_cf_sorting_integration_spec.rb
@@ -60,6 +60,10 @@ RSpec.describe Query::Results, "Sorting by custom field" do
create(:work_package, type:, project:, custom_values: { custom_field.id => value })
end
+ def wp_without_cf_value
+ create(:work_package, type:, project:)
+ end
+
shared_examples "it sorts" do
let(:work_package_desc) { work_packages.reverse }
@@ -90,7 +94,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
let(:work_packages) do
[
- create(:work_package, type:, project:),
+ wp_without_cf_value,
wp_with_cf_value("16"),
wp_with_cf_value("6.25")
]
@@ -104,7 +108,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
let(:work_packages) do
[
- create(:work_package, type:, project:),
+ wp_without_cf_value,
wp_with_cf_value("https://openproject.org/intro/"),
wp_with_cf_value("https://openproject.org/pricing/")
]
@@ -118,7 +122,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
let(:work_packages) do
[
- create(:work_package, type:, project:),
+ wp_without_cf_value,
wp_with_cf_value("6"),
wp_with_cf_value("16")
]
@@ -132,7 +136,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
let(:work_packages) do
[
- create(:work_package, type:, project:),
+ wp_without_cf_value,
wp_with_cf_value("6.25"),
wp_with_cf_value("16")
]
@@ -146,7 +150,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
let(:work_packages) do
[
- create(:work_package, type:, project:),
+ wp_without_cf_value,
wp_with_cf_value("2024-01-01"),
wp_with_cf_value("2030-01-01"),
wp_with_cf_value("999-01-01") # TODO: should be at index 1
@@ -161,7 +165,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
let(:work_packages) do
[
- create(:work_package, type:, project:),
+ wp_without_cf_value,
wp_with_cf_value("0"),
wp_with_cf_value("1")
]
@@ -183,7 +187,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
wp_with_cf_value(id_by_value.fetch("100")),
wp_with_cf_value(id_by_value.fetch("3")),
wp_with_cf_value(id_by_value.fetch("20")),
- create(:work_package, type:, project:) # TODO: should be at index 0
+ wp_without_cf_value # TODO: should be at index 0
]
end
end
@@ -195,7 +199,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
let(:work_packages) do
[
- create(:work_package, type:, project:),
+ wp_without_cf_value,
# TODO: sorting is done by values sorted by position and joined by `.`, why?
wp_with_cf_value(id_by_value.fetch_values("100")), # => 100
wp_with_cf_value(id_by_value.fetch_values("20", "100")), # => 100.20
@@ -239,7 +243,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
wp_with_cf_value(id_by_login.fetch("ba")),
wp_with_cf_value(id_by_login.fetch("bb1")),
wp_with_cf_value(id_by_login.fetch("bb2")),
- create(:work_package, type:, project:) # TODO: should be at index 0
+ wp_without_cf_value # TODO: should be at index 0
]
end
end
@@ -256,7 +260,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
# TODO: second user is ignored
wp_with_cf_value(id_by_login.fetch_values("bb1", "ba")),
wp_with_cf_value(id_by_login.fetch_values("bb1", "ax")),
- create(:work_package, type:, project:) # TODO: should be at index 0
+ wp_without_cf_value # TODO: should be at index 0
]
end
@@ -287,7 +291,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
wp_with_cf_value(id_by_name.fetch("10.10.2")),
wp_with_cf_value(id_by_name.fetch("10.2")),
wp_with_cf_value(id_by_name.fetch("9")),
- create(:work_package, type:, project:) # TODO: should be at index 0
+ wp_without_cf_value # TODO: should be at index 0
]
end
end
@@ -304,7 +308,7 @@ RSpec.describe Query::Results, "Sorting by custom field" do
# TODO: second version is ignored
wp_with_cf_value(id_by_name.fetch_values("9", "10.10.2")),
wp_with_cf_value(id_by_name.fetch_values("9", "10.10.10")),
- create(:work_package, type:, project:) # TODO: should be at index 0
+ wp_without_cf_value # TODO: should be at index 0
]
end