Issue #9660 has been updated by Shota Fukumori.


I guess this ugly patch fixes problem, but I want to find better solutions...

```
diff --git a/lib/test/unit.rb b/lib/test/unit.rb
index ccfe1ce..eb7545b 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -1,5 +1,25 @@
-gem 'minitest', '< 5.0.0' if defined? Gem
+if defined? Gem
+  begin
+    gem 'minitest', '< 5.0.0'
+  rescue Gem::LoadError # for bundler
+  end
+end
+
 require 'minitest/unit'
+
+if '5.0.0' <= MiniTest::Unit::VERSION
+  module Test
+    module Unit
+      class CompatibilityError < Exception
+      end
+    end
+  end
+
+  raise Test::Unit::CompatibilityError,
+    "test/unit only works on MiniTest 4 " \
+    "(MiniTest #{MiniTest::Unit::VERSION} loaded)"
+end
+
 require 'test/unit/assertions'
 require 'test/unit/testcase'
 require 'optparse'
```

----------------------------------------
Bug #9660: test/unit, minitest & bundler
https://bugs.ruby-lang.org/issues/9660#change-45899

* Author: Marc-Andre Lafortune
* Status: Open
* Priority: High
* Assignee: Shota Fukumori
* Category: lib
* Target version: current: 2.2.0
* ruby -v: r45033
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
test/unit now calls `gem 'minitest'`, but this will create regressions for anyone using `bundler`.

For example, create an empty `Gemfile` and try `bundle exec ruby -e "require 'test/unit'"`

You get an error:

    .rvm/gems/ruby-head@global/gems/bundler-1.5.3/lib/bundler/rubygems_integration.rb:240:in `block in replace_gem': minitest is not part of the bundle. Add it to Gemfile. (Gem::LoadError)


See: https://github.com/ruby/ruby/commit/da61291a25faae95f33de6756b2eaa4804d5ef2b#commitcomment-5761129



-- 
https://bugs.ruby-lang.org/