claudegoodies
Command

test

From davila7

Create comprehensive test files with RSpec or Minitest following Ruby testing best practices.

Install

/test

Facts

Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this command runs.

# Ruby Test Generator

Create comprehensive test files with RSpec or Minitest following Ruby testing best practices.

## Purpose

This command helps you quickly create test files with proper structure, examples, and testing patterns for Ruby applications.

## Usage

```
/test
```

## What this command does

1. **Creates test files** with proper structure for RSpec or Minitest
2. **Includes test examples** for common scenarios
3. **Sets up test helpers** and support files
4. **Follows testing conventions** and best practices
5. **Generates factory/fixture data** when needed

## RSpec Example Output

```ruby
# spec/models/user_spec.rb
require 'spec_helper'

RSpec.describe User do
  let(:user) { build(:user) }
  let(:valid_attributes) do
    {
      name: 'John Doe',
      email: '[email protected]',
      age: 30
    }
  end
  
  describe 'validations' do
    it { should validate_presence_of(:name) }
    it { should validate_presence_of(:email) }
    it { should validate_uniqueness_of(:email) }
    it { should validate_numericality_of(:age).is_greater_than(0) }
    
    context 'when email format is invalid' do
      let(:user) { build(:user, email: 'invalid-email') }
      
      it 'is not valid' do
        expect(user).not_to be_valid
        expect(user.errors[:email]).to include('is invalid')
      end
    end
  end
  
  describe 'associations' do
    it { should have_many(:p
View full source on GitHub →

Other slash commands