rails-test

Standardize Rails testing workflows with RSpec, FactoryBot, and Faker patterns.

Updated Oct 12, 2024
One-click install
npx skills add https://github.com/samrocks03/shuttle-office-service --skill rails-test-samrocks03
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-test
Source: https://github.com/samrocks03/shuttle-office-service/tree/main/.claude/skills/rails-test
Command: npx skills add https://github.com/samrocks03/shuttle-office-service --skill rails-test-samrocks03

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails testing can be verbose and inconsistent; this skill standardizes conventions for RSpec, FactoryBot, Faker, DatabaseCleaner, and Rswag to produce reliable, repeatable test suites.

Core Features & Use Cases

  • RSpec-driven testing across models, controllers, requests, and services, with clear organization and shared examples.
  • FactoryBot and Faker for realistic, maintainable test data generation.
  • DatabaseCleaner and strategies to ensure clean, isolated test runs and consistent environments.
  • Rswag and Swagger docs generation from request specs to keep API docs in sync with tests.
  • Code quality tooling with SimpleCov for coverage and Bullet/Prosopite for N+1 query detection.

Quick Start

Run the test suite with the project's factories and Faker data to validate the Rails API.

Frequently Asked Questions about rails-test

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

FAQPage Schema
How do I set up RSpec and FactoryBot for Rails API testing?

You can standardize Rails API testing by using RSpec-driven patterns with FactoryBot factories and Faker data to validate models, controllers, and services while generating realistic, maintainable test data.

What's the best way to keep Swagger API docs in sync with Rails tests?

Using Rswag to generate Swagger documentation directly from request specs ensures your API docs stay synchronized with your test suite, producing consistent and verifiable API endpoint documentation.

How does DatabaseCleaner ensure isolated test runs in Rails?

DatabaseCleaner provides cleaning strategies that ensure clean, isolated test runs and consistent database environments, preventing data leakage between RSpec executions across your Rails API project.

Can I detect N+1 queries and measure code coverage in RSpec?

Yes, you can integrate SimpleCov to measure test code coverage and use Bullet or Prosopite within your RSpec test suite to detect and resolve N+1 query issues.

Does this Rails testing approach work for validating services and models?

Yes, this RSpec-based testing approach supports validating models, controllers, services, and API endpoints within a Rails API project using consistent test data and tooling conventions.