Skip to content
rails-testing logo

Rails Testing

rails-testing

Help with Rails testing including unit tests, integration tests, fixtures, and debugging test failures. Use when working on tests or debugging test issues.

SKILL.md

Full skill instructions

Rails Testing

Instructions

When helping with Rails testing:

  1. Understand the test structure

    • Check existing tests in test/ directory to understand project conventions
    • Look for test patterns in similar files (models, controllers, etc.)
    • Respect the project's test organization and naming conventions
  2. Running tests

    • Run all tests: bin/​rails test
    • Run specific file: bin/​rails test test/​models/​user_test.rb
    • Run specific test: bin/​rails test test/​models/​user_test.rb:5 (line number)
    • Run with verbose output: bin/​rails test -v
    • Use --fail-fast to stop on first failure: bin/​rails test --fail-fast
  3. Test types in Rails

    • Models: Test business logic, validations, associations
    • Controllers: Test request/​response, status codes, redirects, instance variables
    • Integration Tests: Test full workflows across multiple components
    • Fixtures: Use for test data setup
  4. Writing effective tests

    • Use descriptive test names: test_should_create_valid_user
    • Test both success and failure cases
    • Keep tests focused and isolated
    • Use fixtures for shared test data
    • Clean up side effects after tests
  5. Debugging test failures

    • Read error messages carefully - they usually point to the issue
    • Check if test data is set up correctly (fixtures, setup methods)
    • Verify assertions match the actual behavior
    • Use puts or p to inspect values
    • Check test isolation - tests shouldn't depend on each other
  6. Test database

    • Rails uses a separate test database
    • Run migrations: bin/​rails db:test:prepare
    • Check test/​fixtures/ for test data

Examples

When user asks: "How do I test this model?" → Create a model test in test/​models/ following existing patterns, test validations and associations

When user asks: "Why is this test failing?" → Analyze the error, check test data setup, verify assertions, suggest fixes

When user asks: "Add tests for this controller" → Create controller tests in test/​controllers/, test CRUD actions and edge cases

When user asks: "How do I set up test data?" → Suggest fixtures in test/​fixtures/ or setup methods in the test file

More Debugging skills

Evaluate ADK agents with metrics, evalsets, and the iterative eval-fix loop.

6K 472.7K
View

Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

2.7K 431.1K
View
skill-creator logo
Debugging

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

179.7K 399.2K
View

Ultra-compressed code review comments: location, problem, fix on one line each.

109.9K 388.8K
View

Structured debugging methodology that mandates root cause investigation before attempting any fixes.

295.4K 282.4K
View

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View

Comprehensive guide for Firebase Crashlytics, including provisioning and SDK usage. Use this skill when the user needs help setting up Crashlytics, adding crash reporting, or using the Crashlytics SDK in their application.

462 121.1K
View

Comprehensive reference guide for writing, debugging, and maintaining Playwright tests across all testing types and scenarios.

388 90.1K
View

Use for Vercel cost and performance optimization on deployed projects, especially Next.js, SvelteKit, Nuxt, and limited Astro apps. Collect Vercel metrics, usage, project config, and code scan results first; investigate only metric-backed candidates; produce ranked recommendations grounded in verified files and version-aware Vercel/framework docs. Trigger for Vercel bill reduction, slow or expensive routes, caching opportunities, Function Invocations, Build Minutes, Fast Data Transfer, Core Web Vitals, Bot Management, Fluid compute, or cost breakdown requests.

31.9K 89.6K
View

Comprehensive competitor analysis from URLs, combining site scraping with SEO and market data into structured profiles.

53.3K 83.8K
View
obsidian-cli logo
Debugging

obsidian-cli

Read, create, search, and manage Obsidian vault notes via CLI with built-in plugin development and debugging tools.

49.2K 77.7K
View
audit-website logo
Debugging

audit-website

Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.

94 72.3K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
I
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View