rails-testing
Assists in writing, running, and debugging Ruby on Rails tests, fixtures, and integration suites.
Install
mkdir -p .claude/skills/rails-testing && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7491" && unzip -o skill.zip -d .claude/skills/rails-testing && rm skill.zipInstalls to .claude/skills/rails-testing
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Help with Rails testing including unit tests, integration tests, fixtures, and debugging test failures. Use when working on tests or debugging test issues.Key capabilities
- →Execute unit and integration tests using standard Rails CLI
- →Manage test fixture data injection
- →Analyze failed test stack traces for common Rails patterns
- →Run subsets of test suites by line number or file path
- →Validate database schema states in test environments
How it works
It wraps standard bin/rails test commands and applies pattern-matching to provide diagnostic feedback on failure logs.
Inputs & outputs
When to use rails-testing
- →Write unit tests
- →Manage test fixtures
- →Debug failing test suites
- →Execute integration tests
About this skill
Rails Testing
Instructions
When helping with Rails testing:
-
Understand the test structure
- Check existing tests in
test/directory to understand project conventions - Look for test patterns in similar files (models, controllers, etc.)
- Respect the project's test organization and naming conventions
- Check existing tests in
-
Running tests
- Run all tests:
bin/rails test - Run specific file:
bin/rails test test/models/user_test.rb - Run specific test:
bin/rails test test/models/user_test.rb:5(line number) - Run with verbose output:
bin/rails test -v - Use
--fail-fastto stop on first failure:bin/rails test --fail-fast
- Run all tests:
-
Test types in Rails
- Models: Test business logic, validations, associations
- Controllers: Test request/response, status codes, redirects, instance variables
- Integration Tests: Test full workflows across multiple components
- Fixtures: Use for test data setup
-
Writing effective tests
- Use descriptive test names:
test_should_create_valid_user - Test both success and failure cases
- Keep tests focused and isolated
- Use fixtures for shared test data
- Clean up side effects after tests
- Use descriptive test names:
-
Debugging test failures
- Read error messages carefully - they usually point to the issue
- Check if test data is set up correctly (fixtures, setup methods)
- Verify assertions match the actual behavior
- Use
putsorpto inspect values - Check test isolation - tests shouldn't depend on each other
-
Test database
- Rails uses a separate test database
- Run migrations:
bin/rails db:test:prepare - Check
test/fixtures/for test data
Examples
When user asks: "How do I test this model?"
→ Create a model test in test/models/ following existing patterns, test validations and associations
When user asks: "Why is this test failing?" → Analyze the error, check test data setup, verify assertions, suggest fixes
When user asks: "Add tests for this controller"
→ Create controller tests in test/controllers/, test CRUD actions and edge cases
When user asks: "How do I set up test data?"
→ Suggest fixtures in test/fixtures/ or setup methods in the test file
When not to use it
- →Database migrations outside of test preparations
- →Frontend-only integration testing without Rails backend
Prerequisites
Limitations
- →Requires existing test coverage to be useful
- →Cannot fix complex business logic issues without human input
How it compares
It focuses on diagnosing Rails-specific test patterns (fixtures/models) rather than general test execution.
Compared to similar skills
rails-testing side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| rails-testing (this skill) | 1 | 8mo | No flags | Beginner |
| ruby-pro | 1 | 4mo | No flags | Advanced |
| skill-rails-upgrade | 1 | 3mo | Review | Intermediate |
| upgrade-dependencies | 0 | 4mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by etewiah
View all by etewiah →You might also like
ruby-pro
sickn33
Write idiomatic Ruby code with metaprogramming, Rails patterns, and performance optimization. Specializes in Ruby on Rails, gem development, and testing frameworks. Use PROACTIVELY for Ruby refactoring, optimization, or complex Ruby features.
skill-rails-upgrade
sickn33
Analyze Rails apps and provide upgrade assessments
upgrade-dependencies
codenamev
Upgrade all Ruby gem dependencies to their latest versions with release note review and codebase alignment checks. Use this skill whenever the user asks to update, upgrade, or bump dependencies, gems, or packages — even casually like 'update my gems' or 'are my deps up to date?'
rails-domain-architecture
mohnstrudel
Design or refactor the backend side of Ruby on Rails codebases toward a model-centric architecture that keeps domain logic, associations, scopes, callbacks, state transitions, and test ownership close to the owning models. Use when planning backend file layout, deciding between models, concerns, and
rails-expert
Sneha-1608
Use when building or modernizing Rails applications requiring API development, Hotwire reactivity, real-time features, background job processing, deployment automation, or Rails-idiomatic patterns for maximum productivity. Version-aware: adapts to Rails 7.x and 8.x projects.
theme-creation
etewiah
Create new themes for PropertyWebBuilder. Use when creating custom themes, styling websites, or modifying theme templates. Handles theme registration, view templates, CSS, and asset configuration.