4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

fluentdプラグインを作ろうとしたらrake testでエラー出た

4
Last updated at Posted at 2016-03-11

前置き

Rubyとかよくわからないbashishiです。bundle とか rake とかも何が何やらです。
fluentプラグインを作る必要がでてきたのでインターネット上の情報を基に作業を開始しました。

事象

rake test を実行したらエラーになった。

MiniTest::Unit::TestCase is now Minitest::Test. From /usr/share/ruby/2.1/test/unit/testcase.rb:8:in `<module:Unit>'
/usr/share/ruby/2.1/test/unit.rb:676:in `<class:Runner>': undefined method `_run_suite' for class `Test::Unit::Runner' (NameError)

原因

参考サイトの手順で設定を行うと最新のMinitestがインストールされるっぽい。
Minitestがバージョン5になり後方互換性がなくなったため、Test::Unit向けのコードでは動かないようだ。

解決方法

バージョン4.x.xのMinitestをインストールする。
gemspecファイルに以下を追加もしくは変更して bundle update を実行する。5.0.0より小さいなら4.x.xの最新でしょ?っていう雑な設定です。
spec.add_development_dependency "minitest", "< 5.0.0"

bundle update 終わったら rake test でテスト実行。

Finished tests in 0.121391s, 8.2378 tests/s, 0.0000 assertions/s.
1 tests, 0 assertions, 0 failures, 0 errors, 0 skips

通った!
スケルトンができました。

4
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?