chaserx/cpc/rails-testing
Claude Code and agent skill by chaserx/cpc
- community
Checking that the SKILL.md file is still in the repository.
Use when writing or debugging tests in a Rails application, setting up test infrastructure, or choosing between RSpec and Minitest patterns. Also applies when creating factories, fixtures, shared examples, or mocking external services. Covers test strategy, framework detection, directory structure, and common patterns for all test types.
Install
npx vskill@latest install chaserx/cpc/rails-testingSKILL.md
The same SKILL.md was published earlier as chaserx/cpc/rails-testing.
Rails Testing
Guidance for testing Rails applications using RSpec or Minitest, covering test strategy, framework conventions, and common patterns.
Testing Workflow
Follow this process when writing or modifying tests:
- Detect the framework — check for
spec/(RSpec) ortest/(Minitest) - Identify the test type — model, request/controller, system, job, or mailer
- Study existing tests — match the project's style, helpers, and conventions
- Write the test — follow Arrange-Act-Assert, one assertion per test
- Run and verify — ensure the test passes and covers the intended behavior
Framework Detection
Check project structure to determine the testing framework:
spec/directory with_spec.rbfiles → RSpec (with FactoryBot for test data)test/directory with_test.rbfiles → Minitest (with YAML fixtures for test data)
Directory Structures
RSpec
Minitest
Test Writing Principles
Arrange-Act-Assert
One Assertion Per Test
Test Behavior, Not Implementation
Use build Over create When Possible
Prefer build(:user) (in-memory) over create(:user) (persisted) when database state is not needed. This speeds up tests significantly.
Keep Tests Independent
Each test should set up its own data and not depend on ordering or shared mutable state. Use let (RSpec) or setup (Minitest) for per-test setup.
Quick Reference
| Test Type | RSpec Location | Minitest Location | |
|---|---|---|---|
| Model | spec/models/ | test/models/ | |
| Controller/Request | spec/requests/ | test/controllers/ | |
| System | spec/system/ | test/system/ | |
| Job | spec/jobs/ | test/jobs/ | |
| Mailer | spec/mailers/ | test/mailers/ |
| Need | RSpec | Minitest | |
|---|---|---|---|
| Create test data | create(:user) | users(:john) | |
| Assert equal | expect(x).to eq(y) | assert_equal y, x | |
| Assert true | expect(x).to be true | assert x | |
| Assert raises | expect { }.to raise_error | assert_raises { } | |
| Assert changes | expect { }.to change { } | assert_difference |
Running Tests
Additional Resources
Reference Files
For detailed code examples and patterns, consult:
- `references/rspec-patterns.md` — Model specs, request specs, system specs, FactoryBot definitions, shared examples and contexts
- `references/minitest-patterns.md` — Model tests, controller tests, system tests, fixtures, custom assertions, parallel testing
- `references/mocking-services.md` — WebMock stubbing, VCR cassette recording, choosing between the two
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/rails-specialist/skills/rails-testing/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/chaserx/cpc/rails-testing)