How to make a rake test not use the default mini test?

I am following on Create Your Own Gem Guide from RubyGems. The instructions are rake test

executed as follows:

> rake test
~/.rbenv/versions/2.1.2/lib/ruby/2.1.0/minitest/unit.rb:26:in `const_missing': uninitialized constant MiniTest::Test (NameError)
<rest of output truncated>

      

I figured this is because the minimum version is being used 4.7.5

and not 5.6.0

(or any of the 5.0.0 series that is needed in order to have MiniTest::Test

). So I installed minitest 5.6.0

and now I have both versions minitest

. However rake test

, only the version will be used 4.7.5

.

How to make it so that when running rake test

on the right side of t26> in the manual setup?

Using ruby ​​directly works:

 > ruby -Ilib test/test_hola.rb
 Run options: --seed 48777

 # Running:

 ...

 Finished in 0.002862s, 1048.3550 runs/s, 1048.3550 assertions/s.

 3 runs, 3 assertions, 0 failures, 0 errors, 0 skips

      

Removing minitest 4.7.5 is almost impossible;).

Customization

  • Ruby 2.1.2 under rbenv 0.4.0-129-g7e0e85b
  • rake (10.1.0)
  • minitest (5.6.0, 4.7.5)
  • Ubuntu 14.04

Edit

Adding gem "minitest"

to Rakefile

and / or test_hola.rb

doesn't fix the problem.

+3


source to share


2 answers


Solution that I used was to remove the old mini-directory, located at: ~/.rbenv/versions/2.1.2/lib/ruby/2.1.0/minitest/

.

Indeed, despite the return gem list minitest -d

:



*** LOCAL GEMS ***

minitest (5.6.0, 4.7.5)
    Author: Ryan Davis
    Homepage: https://github.com/seattlerb/minitest
    License: MIT
    Installed at (5.6.0): ~/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0
                 (4.7.5, default): ~/.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

      

the location default minitest

was actually ~/.rbenv/versions/2.1.2/lib/ruby/2.1.0/minitest/

. The reported location for the new one minitest

( 5.6.0

in this case) is correct.

0


source


And the next line for your Rakefile:



gem "minitest"

      

0


source







All Articles