Org Web Adapter

hungryroot/jira/be_7536_auto_generate_slugs_for_cookbook_and_cookbookcollection.org

ID
b5b95505-d994-4951-96df-9453a374ab71

BE-7536 - Auto-generate slugs for Cookbook and CookbookCollection

- source :: https://hungryroot.atlassian.net/browse/BE-7536

- tags :: Hungryroot API Project

- epic :: EP-627 Exp 232: Cookbook MVP

- sprint :: HR BE Sprint 107

- status :: Status - Complete

- priority :: Priority - High

- points :: 0.5

Description

User story

As a developer, I want the slug field on Cookbook and CookbookCollection to be

automatically generated and updated so URLs remain consistent, human-readable,

and require no manual slug management.

Acceptance Criteria

Slug auto-generation on create – Cookbook

Given I create a Cookbook with a name/title and no slug

When the record is saved

Then the slug is automatically generated from the name/title

And the slug is URL-safe (lowercase, spaces to hyphens, no unsafe characters).

Slug auto-generation on create – CookbookCollection

Given I create a CookbookCollection with a name/title and no slug

When the record is saved

Then the slug is automatically generated from the name/title using the same

rules.

Slug uniqueness per model

Given two records in the same model with the same name/title

When both are saved

Then each gets a unique slug (e.g., my-first-cookbook, my-first-cookbook-2).

Slug update on source field change

Given an existing record with an auto-generated slug

When I update the name/title and do not explicitly provide a slug

Then the slug is regenerated to match the updated name/title.

Respect explicitly set custom slug

Given I explicitly set a slug on create or update

When the name/title changes later

Then the slug remains unchanged.

Idempotent saves

Given the name/title has not changed

When the record is saved again

Then the slug remains unchanged (no unnecessary regeneration).

Test coverage

Automated tests cover:

slug generation on create for both models

slug regeneration on name/title change

uniqueness behavior

respecting explicitly set custom slugs