rspec-testing

Generate RSpec tests for Rails models, controllers, systems, and services.

59|9|Updated Jul 17, 2025
One-click install
npx skills add https://github.com/dgalarza/claude-code-workflows --skill rspec-testing-dgalarza
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rspec-testing
Source: https://github.com/dgalarza/claude-code-workflows/tree/main/plugins/rails-toolkit/skills/rspec-testing
Command: npx skills add https://github.com/dgalarza/claude-code-workflows --skill rspec-testing-dgalarza

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Rails teams often struggle to maintain consistent, high-quality tests across models, controllers, systems, and integration points, leading to flaky tests and slow feedback.

Core Features & Use Cases

  • Follows TDD with Red-Green-Refactor
  • Enforces Arrange-Act-Assert test structure
  • Provides guidance across model/controller/system/component/service/integration specs
  • Includes concrete examples and decision trees for selecting the right spec type

Quick Start

Follow the guide to install and adopt the recommended RSpec structure in your Rails project.

Frequently Asked Questions about rspec-testing

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

FAQPage Schema
What are the best RSpec patterns for structuring Rails tests?

The best RSpec patterns for Rails tests enforce Arrange-Act-Assert structure, following TDD Red-Green-Refactor cycles. This approach integrates Better Specs and thoughtbot patterns to standardize naming, factory usage, and test organization across model, controller, system, and integration specs for improved reliability.

How do I choose the right RSpec spec type for my Rails application?

To choose the right RSpec spec type, use decision trees targeting model, controller, system, component, service, or integration specs. These guidelines map specific Rails testing scenarios to the correct spec type, ensuring appropriate coverage and reliable test feedback across real-world projects.

How do I set up RSpec testing guidelines in an existing Ruby on Rails project?

Set up RSpec testing guidelines in Rails by adopting recommended structures for syntax, organization, and factory usage. The guidelines streamline creating and maintaining high-quality tests, targeting everything from models to integration points to reduce flaky tests and accelerate feedback cycles.

Why are my Rails tests flaky and how can RSpec guidelines help?

Rails tests become flaky due to inconsistent structure and expectations across models, controllers, and systems. Applying RSpec guidelines with concrete examples and Better Specs patterns standardizes test syntax and factory usage, directly improving test reliability and reducing slow feedback loops.

Does this RSpec testing approach work with TDD workflows?

Yes, this RSpec testing approach works with TDD workflows by explicitly following the Red-Green-Refactor cycle. It provides clear guidance on organizing specs and defining expectations, ensuring test-driven development integrates smoothly into real-world Rails project workflows.