mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Cover historical reservation under :semantic_conversion context
Addresses Copilot review on PR 22982. The previous spec covered historical reservation in the two mode contexts but lost the case where another project's FriendlyId slug history blocks a semantic identifier when the global mode is classic — the exact scenario that drives the converter service's :semantic_conversion path.
This commit is contained in:
@@ -208,5 +208,14 @@ RSpec.describe Projects::IdentifierValidator do
|
||||
project.save!(context: :semantic_conversion)
|
||||
expect(project.reload.identifier).to eq("PROJ")
|
||||
end
|
||||
|
||||
it "rejects a semantic identifier reserved by another project's slug history" do
|
||||
other = create(:project, identifier: "other-id")
|
||||
FriendlyId::Slug.create!(sluggable: other, slug: "PROJ")
|
||||
|
||||
project.identifier = "PROJ"
|
||||
expect(project.valid?(:semantic_conversion)).to be(false)
|
||||
expect(project.errors[:identifier]).to include(I18n.t("activerecord.errors.messages.taken"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user