Files
athena/chezmoi/dot_claude/rules/ecc/ruby/testing.md
T
Зарубин Филипп f219b1fc67 feat: Athena OS Фаза 2 — generic chezmoi-канон Мозга
chezmoi-source (чистая пересборка, не дамп 1.2 ГБ):
- dot_claude: CLAUDE.md лин-роутер, AGENTS.md.tmpl (VPS вычищен),
  settings.json.tmpl (deny-щит 20 + security-guard hook), rules
  (structure + ECC 21 язык), 30 generic ECC-агентов, health-check
- dot_codex: symlink-паритет; dot_agents: registry 13 скриптов
  HOME-генерик + методология docs
- плагины: plugins.manifest + bootstrap Слой 1b (marketplace+install)
- launchd: health.plist (PATH-фикс 127) + session-reaper.example
- smoke++: secret-токен guard + канон-проверки (зелёный)
- 0 hard личных данных; cut личного (kb/references/gsd/owner) → Ф4
2026-06-15 16:59:09 +03:00

1.7 KiB

paths
paths
**/*.rb
**/*.rake
**/Gemfile
**/test/**/*.rb
**/spec/**/*.rb
**/config/routes.rb

Ruby Testing

This file extends common/testing.md with Ruby and Rails specific content.

Framework

  • Use Minitest when the Rails app follows the default Rails test stack.
  • Use RSpec when it is already established in the project or the team has explicit production conventions around it.
  • Do not mix Minitest and RSpec inside the same feature area without a migration reason.

Test Pyramid

  • Put fast domain behavior in model, service, query, policy, and job tests.
  • Use request/controller tests for HTTP contracts, auth behavior, redirects, status codes, and response shapes.
  • Use system tests with Capybara for browser-critical flows only; keep them focused and stable.
  • Cover background jobs with unit tests for behavior and integration tests for queue/enqueue contracts.

Fixtures And Factories

  • Use Rails fixtures when they are the project default and the data graph is small.
  • Use factory_bot when scenarios need explicit object construction or complex traits.
  • Keep test data close to the behavior being asserted; avoid global fixtures that hide setup cost.

Commands

Prefer project-local commands:

bin/rails test
bin/rails test test/models/user_test.rb
bundle exec rspec
bundle exec rspec spec/models/user_spec.rb

Coverage

  • Use SimpleCov when coverage is enforced; keep thresholds in CI and avoid gaming branch coverage with low-value tests.
  • Add regression tests for bug fixes before changing production code.

Reference

See skill: tdd-workflow for the repo-wide RED -> GREEN -> REFACTOR loop.