12

My tests were running without problems, when suddenly the following warning appeared:

MiniTest::Unit::TestCase is now Minitest::Test

This was reported in the following libs:

ruby-1.9.3-p392/lib/ruby/1.9.1/test/unit/testcase.rb:8:in `<module:Unit>'
gems/activesupport-3.2.12/lib/active_support/test_case.rb:12:in `<module:ActiveSupport>'
gems/activesupport-3.2.12/lib/active_support/descendants_tracker.rb:34:in `inherited'

I have no idea what prompted these warnings to appear. Does anybody know what I can do to eliminate the warnings?

The test still appear to run fine, even with the warnings.

My Rails environmentis 3.2.12, running on OSX 10.8.4.

Thanks!

Aaron K
  • 6,901
  • 3
  • 34
  • 29
Dave Isaacs
  • 4,499
  • 6
  • 31
  • 44

3 Answers3

16

You must have upgraded to minitest 5.0. MiniTest::Unit::TestCase was renamed to Minitest::Test. Here are the release notes.

blowmage
  • 8,854
  • 2
  • 35
  • 40
  • okay, but any hints on how to get rid of the warnings, how to make things right for minitest 5? – jrochkind Oct 07 '13 at 15:35
  • 2
    Specify version 4.7.5 in your Gemfile: `gem "minitest", "4.7.5"` – blowmage Oct 08 '13 at 20:08
  • 2
    But why can't I use minitest 5 if I want? Ah, are you saying that minitest 5 is not compatible with ActiveSupport for some reason? – jrochkind Oct 09 '13 at 20:28
  • 8
    Rails 4.0 an below use `MiniTest::Unit::TestCase`, which is what is deprecated in Minitest 5.0. If you want to not get the deprecated warning, use a version where that isn't deprecated. Rails 4.1 uses `Minitest::Test`, which was added in Minitest 5.0. – blowmage Oct 10 '13 at 17:19
7

Another possibility: you're using a newer version of ruby. I was getting this warning/error running on ruby 2.1.2 (even with minitest 4.7.5); downgrading to ruby 2.0.0 resolved it

Justin Stern
  • 101
  • 2
  • 5
  • This is being called from [stdlib `Test::Unit::TestCase`](https://github.com/rubysl/rubysl-test-unit/blob/c24e9beb78656e9d40aa87598976e7bcdc7e7b6f/lib/test/unit/testcase.rb#L8) in Ruby 2.1. Downgrading to Minitest 4 or Ruby 2.0 seem to be the only solutions until stdlib updates for Minitest 5. – jwadsack Dec 02 '14 at 00:17
2

You can use the new gem version of test-unit and minitest together. Example:

gem "test-unit", "~> 3.0"
gem "minitest", "~> 5.5"
1Rhino
  • 298
  • 3
  • 12