rails:test

Generate RSpec tests and FactoryBot factories for Ruby on Rails applications.

1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/fabn/claude-plugins --skill rails-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails:test
Source: https://github.com/fabn/claude-plugins/tree/main/plugins/rails/skills/test
Command: npx skills add https://github.com/fabn/claude-plugins --skill rails-test

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developers often struggle to write or scaffold comprehensive RSpec tests for Rails applications, dealing with conventions, factories, and external stubs manually.

Core Features & Use Cases

  • Detects the project's testing setup (RSpec, Minitest, FactoryBot, VCR, shoulda-matchers) by inspecting the Gemfile and support files.
  • Determines appropriate spec locations for models, services, requests, jobs, policies, etc., and creates or updates spec files following existing project style.
  • Generates or updates FactoryBot factories with sequences, traits, and associations when missing.
  • Handles external HTTP stubbing with VCR cassettes or WebMock, and includes Sidekiq, ActionMailer, and other job/email helpers.
  • Provides error handling for missing test frameworks, schema mismatches, and flaky time‑dependent tests.

Quick Start

Generate a complete RSpec model spec for the User model, including factories and validations.

Frequently Asked Questions about rails:test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate RSpec tests for a Rails model with FactoryBot?

You can generate RSpec tests for Rails models by creating spec files that apply FactoryBot patterns and shoulda-matchers for validations. This process automates factory creation and scaffolds comprehensive test files following existing project conventions.

Does the test generation work with VCR for stubbing external HTTP requests?

Yes, the test generation works with VCR by detecting existing VCR configuration and creating cassette stubs. This ensures external HTTP dependencies are mocked correctly within your Rails project tests.

What types of Rails specs can I scaffold automatically?

You can scaffold model, service, request, job, and policy specs automatically. The generation determines appropriate spec locations and updates files to match your project's existing testing style and conventions.

Can I use this if my Rails project uses Minitest instead of RSpec?

The generation process detects your project's testing setup by inspecting the Gemfile and support files. It provides error handling for missing test frameworks, ensuring compatibility with the detected testing libraries.

How do I create FactoryBot factories with sequences and associations?

FactoryBot factories with sequences, traits, and associations are generated or updated automatically when missing. This ensures your test data creation follows standard FactoryBot patterns without manual configuration.