Use when creating or improving RSpec test coverage for Rails engines. Covers dummy app setup, request, routing, generator, and configuration specs for proving engine behavior within a host application.
82
75%
Does it follow best practices?
Impact
91%
1.49xAverage score across 3 eval scenarios
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./rails-engine-testing/SKILL.mdUse this skill when the task is to create or improve test coverage for a Rails engine.
Prefer integration confidence over isolated test quantity. The main goal is to prove the engine behaves correctly inside a host app.
| Spec Type | Purpose |
|---|---|
| Request | Proves mounted endpoints work; exercises real routing and controller |
| Routing | Verifies engine route expectations and mount behavior |
| Generator | Covers install commands, copied files, idempotency |
| Config | Verifies engine respects host configuration overrides |
| Reload-safety | Regression tests for decorators, patches, and to_prepare hooks |
EVERY engine MUST have a dummy app for testing. This ensures the engine behaves correctly within a host application environment, proving its boot and mount process.
For a non-trivial engine, aim for:
If generators exist, add generator specs. If decorators or reload hooks exist, add reload-focused coverage.
| Mistake | Reality |
|---|---|
| No dummy app | Engines must be tested inside a host; unit tests alone cannot prove mount and integration work |
| Testing against real host instead of dummy | Use spec/dummy; real host apps are environment-specific and slow |
| Skipping reload-safety tests | Decorators and patches can break in development; add regression coverage for reload behavior |
Use the dummy app for:
Do not rely only on isolated unit tests when the behavior depends on Rails integration.
Minimal dummy-app request spec (engine mounted):
# spec/requests/my_engine/root_spec.rb or spec/integration/engine_mount_spec.rb
require 'rails_helper'
RSpec.describe 'MyEngine mount', type: :request do
it 'mounts the engine and returns success for the engine root' do
get my_engine.root_path
expect(response).to have_http_status(:ok)
end
endConfiguration spec (engine respects host config):
# spec/my_engine/configuration_spec.rb
RSpec.describe MyEngine::Configuration do
around do |example|
original = MyEngine.config.widget_count
MyEngine.config.widget_count = 3
example.run
MyEngine.config.widget_count = original
end
it 'uses configured value' do
expect(MyEngine.config.widget_count).to eq(3)
end
endWhen asked to help with tests:
| Skill | When to chain |
|---|---|
| rails-engine-author | When structuring the engine for testability or adding configuration seams |
| rails-engine-reviewer | When validating test coverage adequacy or identifying gaps |
| rspec-best-practices | When improving spec structure, matchers, or shared examples |
ae8ea63
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.