如何使耙测试不使用默认的minitest? [英] How to make rake test not use the default minitest?
问题描述
我遵循RubyGems的制作自己的宝石指南。执行 rake test
指令失败,如下所示:
> rake测试
〜/ .rbenv / versions / 2.1.2 / lib / ruby / 2.1.0 / minitest / unit.rb:26:在`const_missing'中:未初始化的常量MiniTest :: Test(NameError)
<输出的其余部分被截断>
我认为这是因为使用的最小版本是 4.7.5
而不是 5.6.0
(或者任何需要 MiniTest :: Test
有效)。所以我安装了 minitest 5.6.0
,现在我的版本都是 minitest
。但是 rake test
仍将只使用 4.7.5
版本。
如何使 minitest
使用ruby直接工作:
> ruby -Ilib test / test_hola.rb
运行选项: - 种子48777
#正在运行:
...
已完成在0.002862s,1048.3550次运行/秒,1048.3550次断言/秒。
3次运行,3次断言,0次失败,0次错误,0次跳过
删除minitest 4.7.5几乎不可能;)。
$ b
设置
- rbenv下的Ruby 2.1.2 0.4.0-129-g7e0e85b
- rake(10.1.0)
- minitest( 5.6.0,4.7.5)
- Ubuntu 14.04
编辑在 Rakefile中加入
和/或 gemminitest
test_hola.rb
无法解决问题。
我使用的解决方案是删除旧的minitest目录位于: 事实上,尽管
〜/ .rbenv / versions / 2.1.2 / lib / ruby / 2.1.0 / minitest / $ c $
位置实际上是
gem list minitest -d
返回:
***本地GEMS ***
minitest(5.6.0,4.7.5)
作者:Ryan Davis
主页:https://github.com/seattlerb/minitest
许可证:MIT
安装在(5.6.0):〜/ .rbenv / versions / 2.1.2 / lib / ruby / gems / 2.1.0
(4.7.5,默认):〜/ .rbenv / versions / 2.1。 2 / lib / ruby / gems / 2.1.0
minitest提供了一整套测试工具,支持
TDD,BDD,模拟和基准测试
〜/ .rbenv / versions /2.1.2/lib/ruby/2.1.0/minitest /
。新的 minitest
(在这种情况下 5.6.0
)的报告位置是正确的。
I am following along the Make your own Gem Guide from RubyGems. Executing the rake test
instructions fails 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 that it is because the minitest version being used is 4.7.5
and not 5.6.0
(or any of the 5.0.0 series that is needed to have MiniTest::Test
be valid). So I installed minitest 5.6.0
and now I have both versions of minitest
. However rake test
will still only use the 4.7.5
version.
How do I make it so that running rake test
uses the right minitest
within the setting of the Guide?
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
Deleting minitest 4.7.5 is nigh impossible ;).
Setup
- 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"
in Rakefile
and/or test_hola.rb
does not fix the issue.
The solution I used was to delete the old minitest directory located at:
~/.rbenv/versions/2.1.2/lib/ruby/2.1.0/minitest/
.
Indeed, despite gem list minitest -d
returning:
*** 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 default minitest
location was actually ~/.rbenv/versions/2.1.2/lib/ruby/2.1.0/minitest/
. The reported location for the newer minitest
(5.6.0
in this case) is correct.
这篇关于如何使耙测试不使用默认的minitest?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!