Ruby Test Frameworksのロゴ

Ruby Test Frameworks

コミュニティ
st0012
ruby-test-frameworks

Use when writing or running tests in a Ruby project that uses minitest or test-unit. These frameworks have deceptively similar APIs with critical naming differences that cause NoMethodError at runtime. Consult this before writing assertions, running specific tests, or using setup/teardown lifecycle methods.

概要

公開者st0012
リポジトリruby-skills
スキル名ruby-test-frameworks
スター
125
フォーク
7
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    st0012がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルRuby Test FrameworksをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/st0012/ruby-skills/tree/master/plugins/ruby-skills/skills/ruby-test-frameworks
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/st0012/ruby-skills.git /tmp/ruby-skills
mkdir -p .claude/skills
cp -r /tmp/ruby-skills/plugins/ruby-skills/skills/ruby-test-frameworks .claude/skills/ruby-test-frameworks
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでRuby Test Frameworksを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にRuby Test Frameworksを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Ruby Test Frameworksは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Minitest vs Test-Unit Divergences

Only covers where minitest and test-unit diverge. If something isn't listed here, it works the same in both.

Assertion Naming Mismatches

Using the wrong name causes NoMethodError.

Conceptminitesttest-unit
Exceptionassert_raises (plural)assert_raise (singular)
Throwassert_throws (plural)assert_throw (singular)
Collection inclusionassert_includes (plural)assert_include (singular)
Path existsassert_path_exists (with s)assert_path_exist (no s)
Negation patternrefute_* (e.g. refute_nil)assert_not_* (e.g. assert_not_nil)

test-unit aliases minitest names (assert_raises, refute_*, etc.), so minitest syntax works in test-unit but not vice versa.

Assertions That Only Exist in One Framework

test-unit only

MethodPurpose
assert_nothing_raisedPasses if block doesn't raise (also added by Rails on top of minitest)
assert_true / assert_falseChecks for exactly true or false (not just truthy/falsy)
assert_booleanChecks value is true or false
assert_compareFor <, <=, >, >= comparisons
assert_raise_with_messageChecks both exception class and message
assert_raise_messageChecks exception message only (any class)
assert_raise_kind_ofChecks exception via kind_of? instead of exact class
assert_const_defined / assert_not_const_definedCheck constant existence
assert_alias_methodVerify method aliasing
assert_nothing_thrownPasses if block doesn't call throw
assert_blockPasses if block returns truthy

minitest only

MethodPurpose
assert_pattern / refute_patternRuby 3+ pattern matching (in expressions)
assert_silentPasses if block produces no stdout/stderr
assert_outputCheck stdout/stderr content
capture_io / capture_subprocess_ioCapture output for inspection
skip_until(y, m, d, msg)Skip until a date, then fail as reminder
fail_after(y, m, d, msg)Pass until a date, then fail as reminder

minitest 6 breaking change

assert_equal(nil, value) is a hard failure in minitest 6. Use assert_nil(value) instead. test-unit has no such restriction.

Test Selection (CLI Flags)

Operationminitesttest-unit
By name (exact)-n test_method_name--name test_method_name
By name (regex)-n /pattern/--name "/pattern/"
By name (rake)N=/pattern/ rake testN/A
By line numberm test/file.rb:42 or minitest test/file.rb:42 (v6)--location path.rb:LINE
By line (Rails)bin/rails test test/file.rb:42N/A
Exclude by name-e /pattern/--ignore-name /pattern/
Exclude by classN/A--ignore-testcase /pattern/
Filter by classN/A (use -n /ClassName#/)--testcase ClassName
Filter by attributeN/A--attribute "speed == :slow"
Seed-s SEED or --seed SEEDN/A (use --order random)
Stop on failureN/A--stop-on-failure
Execution orderRandom by default--order alphabetic / random / defined
Color-p (pride)--color-scheme SCHEME

minitest 6 renamed -n to -i (--include). -n still works as an alias but is planned for removal.

Rails-specific flags (minitest underneath)

bin/rails test adds: -b (full backtrace), -f (fail-fast), -d (defer output), --profile [N] (slowest tests).

Lifecycle Differences

minitest

before_setup    (for frameworks like Rails)
  setup         (for test authors)
    after_setup
      [TEST]
    before_teardown
  teardown
after_teardown

No class-level hooks. No cleanup. For before(:all) / after(:all), use the minitest-hooks gem.

test-unit

startup           (class method, once before all tests)
  setup           (instance, before each test)
    [TEST]
  cleanup         (instance, only if test didn't raise)
  teardown        (instance, always runs, even if cleanup raised)
shutdown          (class method, once after all tests)

startup/shutdown have no minitest equivalent. cleanup runs after a passing test but before it's marked as passed — use it for verification like mock expectations. teardown always runs regardless of outcome — use it for resource release.

test-unit also supports registering multiple setup/teardown methods by symbol:

ruby
setup :prepare_database, :prepare_cache

Skip / Pending / Omit

Conceptminitesttest-unit
Skip a testskip("reason")omit("reason") or pend("reason")
Conditional skipskip("reason") if conditionomit("reason") if condition or omit_if(condition, "reason") / omit_unless(condition, "reason")
Output characterSO (omit) or P (pend)

Critical difference: test-unit's pend with a block fails if the block passes. This catches code that was fixed but still marked pending. minitest's skip is always unconditional.

ruby
# test-unit: this FAILS if the bug gets fixed
pend("Bug #123") do
  assert_equal(42, buggy_method)  # if this passes, test fails
end

# minitest: no equivalent behavior
skip("Bug #123")  # always skips, no block form

Output Format

Aspectminitesttest-unit
Progress.FES.FEOPN (adds Omit, Pending, Notification)
SummaryN runs, N assertions, N failures, N errors, N skipsN tests, N assertions, N failures, N errors, N pendings, N omissions, N notifications
Throughputruns/s, assertions/stests/s, assertions/s

test-unit Exclusive Features

These have no minitest equivalent:

  • Data-driven tests: data("label", value) method generates parameterized test runs
  • Priority system: priority :must / :important / :high / :normal / :low / :never with probabilistic execution
  • Attributes: Generic metadata on test methods, filterable via --attribute
  • sub_test_case: Named nested test groups (minitest uses describe blocks in Spec mode)
  • notify: Non-fatal informational messages shown as N in output
  • Test runners: Console, Emacs, XML (minitest only has console with plugin system)
  • Config file: ~/.test-unit.yml for persistent settings

Rails Context

Rails uses minitest, not test-unit. But Rails adds aliases and methods that blur the line:

Aliases Rails defines on top of minitest:

Rails aliasDelegates toEffect
assert_not_* (12 methods)refute_*assert_not_nil, assert_not_equal, etc. all work in Rails
assert_notrefuteBase negation
assert_raise (singular)assert_raisesBoth singular and plural work in Rails
assert_no_matchrefute_match

Methods Rails adds (not in either framework):

MethodPurpose
assert_nothing_raisedPasses if block doesn't raise
assert_difference / assert_no_differenceCheck numeric change after block
assert_changes / assert_no_changesCheck value change after block

This means in Rails: assert_not_nil, assert_raise, and assert_nothing_raised all work — but they will not work if you move the test to plain minitest outside Rails.

よくある質問

AIスキル「Ruby Test Frameworks」では何ができますか?

Use when writing or running tests in a Ruby project that uses minitest or test-unit. These frameworks have deceptively similar APIs with critical naming differences that cause NoMethodError at runtime. Consult this before writing assertions, running specific tests, or using setup/teardown lifecycle methods.

TypingMindでRuby Test Frameworksを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Ruby Test Frameworksはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにRuby Test Frameworksをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/st0012/ruby-skills/tree/master/plugins/ruby-skills/skills/ruby-test-frameworksを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Ruby Test Frameworksを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Ruby Test Frameworksは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもRuby Test Frameworksを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Ruby Test Frameworks」は無料ですか?

はい。st0012がGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇