- Write tests that read as documentation — descriptive names that explain the expected behavior.
- Each test should verify one behavior. Keep tests focused and independent.
- Use `let()` for lazy-evaluated test data and `before(:each)` for setup — use FactoryBot for complex test object creation.
- Use factory libraries for test data: separate persisted objects from in-memory builders.
- Group tests by scenario using nested contexts (e.g., `when user is admin`, `when input is empty`).
- Use shared test behaviors for DRY specs when multiple classes share the same interface.
- Isolate tests from external services — stub HTTP calls and mock external dependencies.