RA

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.zip

Installs 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.
155 chars✓ has a “when” trigger
Beginner

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

You give it
Test file path or test case name
You get back
Test execution results and failure analysis

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:

  1. 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
  2. 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-fast to stop on first failure: bin/rails test --fail-fast
  3. 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
  4. 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
  5. 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 puts or p to inspect values
    • Check test isolation - tests shouldn't depend on each other
  6. 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

Rails application setupActive database instance

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.

SkillInstallsUpdatedSafetyDifficulty
rails-testing (this skill)18moNo flagsBeginner
ruby-pro14moNo flagsAdvanced
skill-rails-upgrade13moReviewIntermediate
upgrade-dependencies04moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

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.

12

skill-rails-upgrade

sickn33

Analyze Rails apps and provide upgrade assessments

11

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?'

00

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

00

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.

00

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.

310

Search skills

Search the agent skills registry