testing

rubys's avatarfrom rubys

Information about running tests, test coverage, and known testing issues in the Rails application. Use when the user asks about testing procedures, encounters test failures, wants to know about coverage, or needs to troubleshoot intermittent system test issues.

⭐34stars🔀6forks📁View on GitHub🕐Updated Dec 24, 2025

When & Why to Use This Skill

This Claude skill serves as a specialized assistant for managing and troubleshooting the testing suite of a Ruby on Rails application. It provides instant access to testing procedures, coverage metrics, and actionable solutions for common CI/CD bottlenecks like intermittent system test failures and asset routing conflicts, ensuring a more robust and reliable development workflow.

Use Cases

  • Test Suite Execution: Streamline the process of running unit, integration, and system tests using standardized Rails commands and database reset procedures.
  • Coverage Monitoring: Identify gaps in the codebase by reviewing detailed coverage reports for core business logic, such as heat scheduling and scoring algorithms.
  • System Test Troubleshooting: Resolve flaky Capybara/Selenium tests caused by race conditions through targeted reruns and specific line-item debugging.
  • Environment Maintenance: Fix 'No route matches' asset errors in the test environment by automating the clobbering of precompiled assets.
nametesting
descriptionInformation about running tests, test coverage, and known testing issues in the Rails application. Use when the user asks about testing procedures, encounters test failures, wants to know about coverage, or needs to troubleshoot intermittent system test issues.

Testing

Running Tests

# Run all tests except system tests
bin/rails test

# Run with coverage report (SimpleCov generates /coverage/index.html)
bin/rails test

# Run system tests
bin/rails test:system

# Reset database and run tests
bin/rails test:db

Test Coverage

Current coverage: ~7.0% (600/8600 lines)

Comprehensive test coverage for core ballroom dance competition models:

  • HeatScheduler concern - heat scheduling algorithm
  • Entry model - validation logic, pro-am relationships
  • Heat model - basic functionality + scrutineering rules
  • Person model - STI, validations, billing, name parsing
  • Score model - judge scoring, JSON handling, scrutineering
  • Dance model - dance types, categories, multi-dance events
  • Category model - competition categories, extensions, scheduling
  • Table model - seating assignments, studio relationships, grid positioning
  • TablesController - two-phase assignment algorithm achieving 100% success rate

Testing Approach

  • Standard Rails minitest for unit/integration tests
  • System tests using Capybara and Selenium
  • Fixtures for test data (test/fixtures/*)
  • No separate linting or code style tools configured

Known Testing Issues

Intermittent System Test Failures

There is a known timing issue where system tests may intermittently fail to find an "Edit" button after hovering over a line (particularly in formations_test.rb). This is a race condition in the Capybara/Selenium interaction.

When this occurs, rerun the individual failing test to verify it passes:

bin/rails test test/system/formations_test.rb:38  # or the specific failing test line

System Test Asset Routing Failures

If system tests fail with "No route matches [GET] '/showcase/assets/...'" errors, this is caused by precompiled assets interfering with the test environment.

Clean the assets and rerun:

bin/rails assets:clobber
bin/rails test:system