3

After install ruby 2.1.2 on my Macbook Pro, I found the default minitest version is 4.7.5, I do sodo gem install minitest to install minitest 5.4.2, but the default gem is 4.7.5 yet. I also do gem cleanup,that didn't remove the old version.I had try gem uninstall minitest -v 4.7.5 and got

RROR: While executing gem ... (Gem::InstallError) gem "minitest" cannot be uninstalled because it is a default gem

So how can I change the default gem to version 5.4.2 and remove the old one? If I don't change this, I have to write class AbcTest < MiniTest::Unit::TestCase not class AbcTest < Minitest::Test in my test. Or modify Gemfile everytime I create a new project.

PS:

Ruby version: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]

gem list minitest -d

minitest (5.4.2, 4.7.5) Author: Ryan Davis Homepage: https://github.com/seattlerb/minitest License: MIT Installed at (5.4.2): /Users/xxxxx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0 (4.7.5, default): /Users/xxxxx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0 minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking

greyby
  • 156
  • 1
  • 8
  • Addressed here: http://stackoverflow.com/questions/20945110/how-can-i-remove-a-default-gem-want-to-uninstall-a-gem-1-7-7-version-of-json and further here: http://stackoverflow.com/a/15133988/2117020. Not sure if you actually need to delete it, though. Output `Minitest::VERSION` in your test script. Most probably it is already 5.4.2. – moonfly Oct 09 '14 at 03:05
  • @moonfly Both can't work and the output is 4.7.5 – greyby Oct 09 '14 at 07:41
  • `Minitest::VERSION` doesn't work with older versions of Minitest, such as 4.3. However, `MiniTest::Unit::VERSION` does. – ThomasW Jul 21 '15 at 09:35

2 Answers2

0

you can try this for uninstalling the older version:

gem uninstall minitest -v 4.7.5

Refer Ruby Gems guide

Richa Sinha
  • 1,406
  • 15
  • 29
  • 1
    I had try this and got```ERROR: While executing gem ... (Gem::InstallError) gem "minitest" cannot be uninstalled because it is a default gem``` – greyby Oct 09 '14 at 07:07
0

I had a similar issue: "How to make rake test not use the default minitest?".

You can delete the ~/.rbenv/versions/2.1.2/lib/ruby/2.1.0/minitest/ directory. Your more recent minitest gem will then be used automatically.

Community
  • 1
  • 1
William
  • 155
  • 2
  • 10