After upgrading from Rails 3.2 to Rails 4, my app works, but my tests, written with test-unit, are a disaster.
Minitest is rumored to be "compatible" with test-unit. However, if I attempt to use the (now bundled) Minitest, there are a raft of differences - from the assert* statement names and parameters to (clearly) many other things things both large and subtle.
If I instead try to avoid Minitest and attempt to keep my test-unit gem in my Gemfile, rake test explodes, saying,
undefined method 'refute_predicate' for class 'ActiveSupport::TestCase'
This results from having called
require 'rails/test_help'
:(
I have been searching for a while but have not yet figured out any way to continue using test-unit. The only alternative would seem to be a (for us, massive) refactoring of our test code, since something like 80% of our tests are broken in some way or other by Minitest's incompatibilities with test-unit.
Yet reading i.e. http://weblog.rubyonrails.org/2013/6/25/Rails-4-0-final/ and http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0 I find no mention of this in substance - I feel like must be missing something.
Is it possible to make Minitest more compatible with test-unit in a systematic way? Or to continue using test-unit in Rails 4?
Are you subclassing: Test::Unit::TestCase and not ActiveSupport::TestCase?
Maybe try adding minitest_tu_shim to your test group:
https://github.com/seattlerb/minitest_tu_shim
or make sure to subclass ActiveSupport::TestCase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With