rspec

Guide RSpec testing for Rails models, requests, and system specs.

1|3|Updated Oct 24, 2018
One-click install
npx skills add https://github.com/ICI-Cancionero/gedeon-app-rails --skill rspec-ici-cancionero
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rspec
Source: https://github.com/ICI-Cancionero/gedeon-app-rails/tree/main/.agents/skills/rspec
Command: npx skills add https://github.com/ICI-Cancionero/gedeon-app-rails --skill rspec-ici-cancionero

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Rails projects often struggle with flaky or hard-to-maintain tests. This skill provides a structured approach to design, write, and maintain robust RSpec tests across models, controllers, requests, and system flows.

Core Features & Use Cases

  • Guidance for model specs, request specs, system specs, factories, mocks, and TDD workflows.
  • Best practices for test organization, readability, and maintainability in Rails apps.
  • Real-world examples and references to accelerate test reliability and debugging.

Quick Start

Explore the examples and apply the RSpec patterns to your Rails project to quickly improve test reliability.

Frequently Asked Questions about rspec

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

FAQPage Schema
How do I write maintainable RSpec tests for Rails applications?

To write maintainable RSpec tests for Rails, apply structured patterns for model, request, and system specs. This approach improves test organization, readability, and reliability while supporting TDD workflows and best practices.

What is the best way to structure Rails request specs and system specs?

The best way to structure Rails request specs and system specs is by following established RSpec patterns. This provides comprehensive guidance for testing controller endpoints and system flows, ensuring robust integration coverage and reducing flaky tests.

How do I use factories and mocks in RSpec model specs?

Using factories and mocks in RSpec model specs involves applying specific testing patterns to isolate database dependencies and simulate object behavior. This streamlines Rails testing by keeping model tests fast and focused.

Can I use TDD workflows with RSpec in Ruby on Rails projects?

Yes, you can use TDD workflows with RSpec in Ruby on Rails projects. The testing guidance supports test-driven development practices across models, requests, and system flows to ensure robust test coverage.

Why are my Rails tests flaky and how do I fix them?

Rails tests become flaky due to poor test organization and lack of structured patterns. You can fix flaky tests by applying RSpec best practices for model, request, and system specs, using factories and mocks to ensure reliability.