rspec-rails
Installation
SKILL.md
Writing Ruby on Rails Specs with RSpec
When writing RSpec tests for Ruby on Rails applications, follow these guidelines to ensure comprehensive, maintainable, and well-structured test coverage.
Core Principles
1. Test Coverage Strategy
- No controller tests in most cases if we have
spec/requestand/or Capybara feature specs that already test the same thing - Add a unit test for every new method added to models, services, and lib classes
- Test behavior, not implementation - focus on inputs and outputs
- Keep tests isolated - each test should be independent
2. File Structure
Organize specs to mirror application structure: