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

[#57816] added contract test with localized error validation

Eric Schubert79287943d772
diff --git a/spec/contracts/custom_fields/hierarchy/insert_item_contract_spec.rb b/spec/contracts/custom_fields/hierarchy/insert_item_contract_spec.rb
index 72992247c52..19537faaab5 100644
--- a/spec/contracts/custom_fields/hierarchy/insert_item_contract_spec.rb
+++ b/spec/contracts/custom_fields/hierarchy/insert_item_contract_spec.rb
@@ -69,6 +69,17 @@ RSpec.describe CustomFields::Hierarchy::InsertItemContract do
expect(result).to be_failure
expect(result.errors.to_h).to include(label: ["must be unique within the same hierarchy level"])
end
+
+ context "if locale is set to 'de'" do
+ it "is invalid with localized validation errors" do
+ I18n.with_locale(:de) do
+ result = subject.call(params)
+ expect(result).to be_failure
+ # TODO: This needs to be switched to german once the german translation is merged.
+ expect(result.errors.to_h).to include(label: ["must be unique within the same hierarchy level"])
+ end
+ end
+ end
end
context "when short is set and is a string" do