.ai/principles/baselines/testing-rspec.md
||, &&, if/else, case), verify each branch has test coveragebefore_validation, before_save), ensure unit specs test the callback behavior specifically|| operators)default_enabled: value in the YAML definition), so DO NOT stub a flag to true to reach its enabled path — the only exception is a flag explicitly disabled in spec/spec_helper.rb, where stubbing to true is warrantedstub_feature_flags(flag: false) to test the disabled code pathspec/requests/api/pages_spec.rb, DO NOT create spec/requests/api/pages/pages_spec.rb)match_array instead of eq or match to avoid dataset-specific flakiness.first, .last, or .take on an ActiveRecord relation without an explicit .order(...) — PostgreSQL does not guarantee row order without ORDER BY, which causes dataset-specific flaky testsFaker or random values, ensure the test handles any value the generator can produce; if the test depends on a specific format, use a hardcoded value instead