This skill may not reflect the latest upstream change
Next.js Releases update on 2026-11-09 may affect this skill Last checked Nov 26, 2026.
rspec
RSpec testing best practices for Ruby and Rails applications, covering test organization, data management, and isolation patterns.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install mindrally-rspecManual setup by platform
Claude Code
~/.claude/skills/mindrally-rspec/SKILL.md
Signing
SignedSLSA L2- Signed by
- skills-hub.ai distributor
- Method
- Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
- Key
- skills-hub-ed25519-2026-11
- Signed
Instructions
RSpec Testing Best Practices
You are an expert in Ruby, Rails, and RSpec testing.
Key Principles
Comprehensive Coverage
Tests must cover both typical cases and edge cases, including invalid inputs and error conditions.
Readability and Clarity
- Employ descriptive names for
describe,context, anditblocks - Use the
expectsyntax for improved assertion readability - Keep test code concise without unnecessary complexity
- Include comments explaining complex logic
Test Organization
- Use
describefor classes/modules andcontextfor different scenarios - Use the
subjecthelper to prevent repetition when defining objects under test - Mirror your source file structure within the spec directory
Test Data Management
- Leverage
letandlet!for minimal, necessary setup - Prefer FactoryBot factories over fixtures for generating test data
- Create only the data necessary for each test
Test Isolation
- Each test must be independent without shared state between tests
- Mock external services (APIs, databases) and stub methods appropriately
- Avoid over-mocking: test real behavior when feasible
Reduce Duplication
- Share common behaviors across contexts using
shared_examples - Extract repetitive patterns into helpers or custom matchers
- Use
shared_contextfor common setup across multiple specs
Example Structure
RSpec.describe User, type: :model do
subject { build(:user) }
describe 'validations' do
it { is_expected.to validate_presence_of(:email) }
it { is_expected.to validate_uniqueness_of(:email) }
end
describe '#full_name' do
context 'when both first and last name are present' do
let(:user) { build(:user, first_name: 'John', last_name: 'Doe') }
it 'returns the combined name' do
expect(user.full_name).to eq('John Doe')
end
end
context 'when last name is missing' do
let(:user) { build(:user, first_name: 'John', last_name: nil) }
it 'returns only the first name' do
expect(user.full_name).to eq('John')
end
end
end
end
Security
Reviews (0)
Related skills
Browse all →More from Mindrally Skills
View source →More Build skills
Browse category →Frequently asked questions about rspec
What does the rspec skill do?
RSpec testing best practices for Ruby and Rails applications, covering test organization, data management, and isolation patterns. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the rspec skill?
Run `npx @skills-hub-ai/cli install mindrally-rspec` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/mindrally-rspec/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does rspec work with?
rspec runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the rspec skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use rspec after installing it?
In Claude Code, type `/mindrally-rspec` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the rspec skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.