ruby-testing

Guide Ruby/RSpec testing with FactoryBot traits and behavior-focused workflows.

2|Updated Feb 18, 2019
One-click install
npx skills add https://github.com/arowinski/dotfiles --skill ruby-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ruby-testing
Source: https://github.com/arowinski/dotfiles/tree/main/claude/skills/ruby-testing
Command: npx skills add https://github.com/arowinski/dotfiles --skill ruby-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ruby, rspec, factory_bot, ripgrep.

What problem does it solve?

This Skill addresses the challenge of writing consistent, high-quality Ruby/RSpec tests that adhere to project conventions. It helps developers avoid common anti-patterns, ensuring maintainable and effective test suites.

Core Features & Use Cases

  • Behavior-Driven Testing Guidance: Guides you to test observable outcomes and public interfaces, not internal implementation details.
  • FactoryBot Best Practices: Enforces proper usage of FactoryBot with traits, optimizing test data creation.
  • Structured Test Workflow: Provides a clear, step-by-step workflow for structuring new and existing RSpec files, promoting readability and consistency.
  • Use Case: When you're adding a new feature to a Ruby on Rails application, use this Skill to generate a well-structured RSpec test file that adheres to your team's best practices, ensuring consistency and maintainability without manual effort.

Quick Start

Help me write RSpec tests for the User model, focusing on the authenticate method.

Frequently Asked Questions about ruby-testing

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

FAQPage Schema
How do I write behavior-focused RSpec tests instead of testing implementation details?

Behavior-focused RSpec testing means asserting on observable outcomes and public interfaces rather than private methods or internal state. This Skill guides you to structure tests around what your code does, not how it does it, improving test maintainability and reducing brittleness when refactoring.

What's the best way to structure RSpec test files for Ruby projects?

Effective RSpec structure uses clear test phases separated by blank lines, descriptive context blocks, and readable assertions. This Skill provides a step-by-step workflow for organizing new and existing RSpec files consistently, ensuring your test suite stays readable and maintainable as it grows.

How should I use FactoryBot traits to create test data in RSpec?

FactoryBot traits let you define reusable object configurations for different test scenarios. This Skill enforces best practices for trait usage, optimizing test data creation and reducing duplication while keeping your factories clean and intentional.

What are common anti-patterns to avoid when writing Ruby RSpec tests?

Common RSpec anti-patterns include testing private methods, omitting test phase separation, misusing FactoryBot, and asserting on implementation rather than behavior. This Skill identifies these pitfalls and guides you toward patterns that produce durable, high-quality test suites.

Can I apply consistent testing conventions across a Ruby on Rails team?

Yes. This Skill provides standardized workflow and guidelines for Ruby/RSpec testing that enforce behavior-driven practices, FactoryBot conventions, and test structure patterns. Use it when adding features to ensure all team members write tests consistently without manual code review overhead.