minitest-testing — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited minitest-testing (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Write comprehensive, maintainable Minitest tests following Rails conventions and best practices. This skill provides patterns for model tests, controller tests, system tests with Capybara, and fixture usage.
<when-to-use>
</when-to-use>
<benefits>
bin/rails test:parallel</benefits>
<verification-checklist> Before completing testing work:
test "descriptive name"bin/rails test</verification-checklist>
<standards>
test "creates post with valid attributes"assert_equal, assert_redirected_to, not just assertposts(:published_post)setup and teardown for test lifecycle managementassert_difference for counting changes</standards>
Organize tests with clear phases:
test "creates article with valid attributes" do
# Arrange - set up test data
user = users(:alice)
# Act - perform the action
article = Article.create(
title: "Test Article",
body: "Content here",
user: user
)
# Assert - verify the outcome
assert article.persisted?
assert_equal "Test Article", article.title
endEach test should be independent and able to run in any order. Use setup for common initialization:
class ArticleTest < ActiveSupport::TestCase
setup do
@user = users(:alice)
@article = articles(:published)
end
test "publishes article" do
@article.publish!
assert @article.published?
end
endEach test verifies one behavior, though it may use multiple assertions to fully verify that behavior.
test/models/)Test business logic, validations, associations, and custom methods.
File location: test/models/article_test.rb
class ArticleTest < ActiveSupport::TestCase
test "validates presence of title" do
article = Article.new(body: "Content")
assert_not article.valid?
assert_includes article.errors[:title], "can't be blank"
end
test "belongs to user" do
article = articles(:published)
assert_instance_of User, article.user
end
test "#published? returns true when status is published" do
article = articles(:published)
assert article.published?
end
endtest/controllers/)Test HTTP responses, redirects, authentication, and parameter handling.
File location: test/controllers/articles_controller_test.rb
class ArticlesControllerTest < ActionDispatch::IntegrationTest
setup do
@user = users(:alice)
sign_in_as(@user) # helper method
end
test "GET index returns success" do
get articles_path
assert_response :success
end
test "POST create with valid params creates article" do
assert_difference("Article.count", 1) do
post articles_path, params: {
article: { title: "New Article", body: "Content" }
}
end
assert_redirected_to article_path(Article.last)
end
test "POST create with invalid params renders new" do
assert_no_difference("Article.count") do
post articles_path, params: {
article: { title: "", body: "" }
}
end
assert_response :unprocessable_entity
end
endtest/system/)Test end-to-end user workflows with browser simulation.
File location: test/system/article_creation_test.rb
class ArticleCreationTest < ApplicationSystemTestCase
test "user creates new article" do
visit root_path
click_on "New Article"
fill_in "Title", with: "My Test Article"
fill_in "Body", with: "This is the content"
select "Published", from: "Status"
click_on "Create Article"
assert_text "Article was successfully created"
assert_text "My Test Article"
end
test "article updates with Turbo Frame" do
article = articles(:draft)
visit article_path(article)
click_on "Edit"
fill_in "Title", with: "Updated Title"
click_on "Update Article"
# Turbo Frame update - no full page reload
assert_text "Updated Title"
assert_no_text article.title
end
endFor comprehensive Minitest patterns and examples, see [examples.md](examples.md).
examples.md contains:
Refer to examples.md for complete code examples.
# Equality
assert_equal expected, actual
assert_not_equal unexpected, actual
# Truth/Falsehood
assert value
assert_not value
assert_nil value
assert_not_nil value
# Predicates
assert article.valid?
assert_not article.persisted?
assert articles.empty?
# Collections
assert_includes array, item
assert_empty collection
assert_not_empty collection
# Differences (counting changes)
assert_difference "Article.count", 1 do
Article.create!(title: "New", body: "Content")
end
assert_no_difference "Article.count" do
Article.create(title: "", body: "") # invalid
end
# HTTP Responses
assert_response :success
assert_response :redirect
assert_response :not_found
assert_redirected_to articles_path
# Errors
assert_raises ActiveRecord::RecordInvalid do
Article.create!(title: nil)
endtest/fixtures/*.yml)# test/fixtures/users.yml
alice:
email: [email protected]
name: Alice Smith
role: admin
bob:
email: [email protected]
name: Bob Jones
role: member# test/fixtures/articles.yml
published:
user: alice
title: Published Article
body: This article is live
status: published
published_at: <%= 1.day.ago %>
draft:
user: bob
title: Draft Article
body: Work in progress
status: drafttest "finds published articles" do
published = articles(:published)
draft = articles(:draft)
results = Article.published
assert_includes results, published
assert_not_includes results, draft
end# test/test_helper.rb
class ActionDispatch::IntegrationTest
def sign_in_as(user)
post login_path, params: { email: user.email, password: "password" }
end
end# test/test_helper.rb
module ActiveSupport
class TestCase
def assert_valid(record)
assert record.valid?, "Expected #{record.class} to be valid, errors: #{record.errors.full_messages}"
end
end
end<testing>
# Run all tests
bin/rails test
# Run specific test file
bin/rails test test/models/article_test.rb
# Run specific test by line number
bin/rails test test/models/article_test.rb:12
# Run tests by pattern
bin/rails test test/models/*_test.rb
# Run system tests only
bin/rails test:system
# Run tests in parallel
bin/rails test:parallel
# Run with verbose output
bin/rails test -v
# Run and show coverage
COVERAGE=true bin/rails test</testing>
<related-skills>
</related-skills>
<resources>
Official Documentation:
Tools:
</resources>
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.