rails-testing
БесплатноБез исполняемых скриптовНе проверенRuby on Rails testing best practices for writing effective, maintainable test suites with RSpec. This skill should be used when writing, reviewing, or…
от pproenca★ 231 звезда на GitHubОб этом скилле
Community Ruby on Rails Testing Best Practices
Comprehensive testing guide for Ruby on Rails applications, maintained by Community. Contains 46 rules across 8 categories, prioritized by impact to guide automated test generation, review, and refactoring.
When to Apply
Reference these guidelines when:
- Writing new RSpec specs for models, requests, system tests, or jobs
- Setting up FactoryBot factories with traits and sequences
- Writing Capybara system tests for user journeys
- Testing background jobs with Sidekiq or Active Job
- Reviewing test code for anti-patterns (mystery guests, flaky tests, slow specs)
- Optimizing test suite performance and CI pipeline speed
- Organizing test files, shared examples, and custom matchers
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Test Design & Structure | CRITICAL | design- |
| 2 | Test Data Management | CRITICAL | data- |
| 3 | Model Testing | HIGH | model- |
| 4 | Request & Controller Testing | HIGH | request- |
| 5 | System & Acceptance Testing | MEDIUM-HIGH | system- |
| 6 | Async & Background Job Testing | MEDIUM | async- |
| 7 | Test Performance & Reliability | MEDIUM | perf- |
| 8 | Test Organization & Maintenance | LOW-MEDIUM | org- |
Quick Reference
1. Test Design & Structure (CRITICAL)
design-four-phase-test- Use four-phase test structure (setup, exercise, verify, teardown)design-behavior-over-implementation- Test observable behavior, not internal implementationdesign-one-assertion-per-test- One logical expectation per test for precise failure diagnosisdesign-descriptive-test-names- Write test names that read like specificationsdesign-avoid-mystery-guest- Make all test data visible within the test itselfdesign-avoid-conditional-logic- No if/else or loops in test codedesign-explicit-subject- Name subjects explicitly instead of using implicit subject
2. Test Data Management (CRITICAL)
data-factory-traits- Use composable factory traits instead of separate factoriesdata-minimal-attributes- Specify only attributes relevant to the testdata-build-over-create- Prefer build/build_stubbed over create when persistence isn't neededdata-avoid-fixture-coupling- Use factories instead of shared fixturesdata-transient-attributes- Use transient attributes for complex factory setupdata-sequence-unique-values- Use sequences for uniqueness-constrained fields
3. Model Testing (HIGH)
model-test-validations- Test validations with boundary cases, not just happy pathmodel-test-associations- Test associations explicitly including dependent behaviormodel-test-scopes- Test scopes with matching and non-matching recordsmodel-test-callbacks-sparingly- Test callback side effects, not callback existencemodel-test-custom-methods- Test public methods with input/output pairs across scenariosmodel-avoid-testing-framework- Don't test ActiveRecord or framework behaviormodel-test-enums- Test enum transitions and generated scopes
4. Request & Controller Testing (HIGH)
request-over-controller-specs- Use request specs over deprecated controller specsrequest-test-response-status- Assert HTTP status codes explicitlyrequest-test-authentication- Test authentication boundaries for every protected endpointrequest-test-authorization- Test authorization for each rolerequest-test-params-validation- Test parameter validation and edge casesrequest-json-response-structure- Assert JSON response structure for API endpoints
5. System & Acceptance Testing (MEDIUM-HIGH)
system-page-objects- Encapsulate page interactions in page objects- [
system-use-accessible-selectors](refe
Установить rails-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл rails-testing?
Ruby on Rails testing best practices for writing effective, maintainable test suites with RSpec. This skill should be used when writing, reviewing, or refactoring Rails tests to ensure proper test design, data management, and coverage patterns. Triggers on tasks involving RSpec specs, model tests, request specs, system tests, factory definitions, Capybara interactions, Sidekiq job tests, or test suite optimization. Complementary to rails-dev, ruby-optimise, and ruby-refactor skills.
Как установить скилл rails-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rails-testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic