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:
Kabiru Mwenja
2026-04-29 12:02:24 +03:00
parent 47fe076905
commit 0acda9d84b
@@ -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