rails-cto-minitest
The testing skill. Writes and maintains Minitest tests using the Spec DSL.
What it does
This project uses Minitest::Spec DSL — not RSpec, not vanilla Minitest::Test. Every test file follows a consistent structure so tests are easy to scan and extend. The skill covers:
- Model tests in
test/models/ - Command and service tests in
test/commands/andtest/services/ - Controller and integration tests in
test/controllers/andtest/integration/ - Job tests in
test/jobs/ - ViewComponent tests in
test/components/ - System tests in
test/system/
Core conventions the skill enforces:
subjectblock declared exactly once at the top of the classlet(:attributes)pattern for test variations — don't reassignsubjectinlinedescribeblocks for contextual grouping- Parallel tests enabled (the test helper is already patched)
- SimpleCov coverage reported via the JSON formatter so
rails-cto-qacan read it - Fabricators (Fabrication gem) for test data, not fixtures
When it triggers
- Creating or fixing any file under
test/ - Generating a new model, controller, command, job, or component that needs accompanying tests
- When you mention test, minitest, spec, coverage, fixture, fabricator, assertion, or ask to "add tests"
- Whenever
rails-cto-qadetects a changed.rbfile without a matching test
Example
ruby
# test/models/plan_test.rb
require "test_helper"
class PlanTest < ActiveSupport::TestCase
let(:attributes) { {} }
subject { Fabricate.build(:plan, **attributes) }
describe "#price_summary" do
describe "with monthly interval" do
let(:attributes) { { amount: 1200, interval: "month" } }
it "returns formatted price" do
assert_equal "$12.00 / month", subject.price_summary
end
end
describe "with annual interval" do
let(:attributes) { { amount: 12000, interval: "year" } }
it "returns formatted price" do
assert_equal "$120.00 / year", subject.price_summary
end
end
end
end