mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 23:39:03 +00:00
for_owner bootstraps a Goal::Retirement before any target exists, but goals.target_amount was NOT NULL at the DB level — the target_amount_required? hook only dropped the AR validation. Creating a plan for a user with no existing record (the demo user, caught in a live browser smoke) raised PG::NotNullViolation. Tests missed it because for_owner(family_admin) finds the retirement_bob fixture and never inserts. Relaxes the column to nullable and re-asserts the guarantee for savings goals via a type-aware check (type <> 'Goal' OR target_amount IS NOT NULL), so base Goal rows still require a target at the DB level. Adds tests that exercise the create path (a user with no fixture plan).