如何添加 gem ‘minitest’给我的测试助手?

发布于 2024-12-10 05:59:34 字数 781 浏览 0 评论 0原文

我是 Ruby on Rails 和测试的新手。当我运行rake test时,出现以下错误:

/Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rack-1.3.4/lib/rack/backports
/uri/common_192.rb:53: warning: already initialized constant WFKV_
/Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/turn-0.8.3/lib/turn/autorun
/minitest.rb:14:in `<top (required)>': MiniTest v1.6.0 is out of date. (RuntimeError)
`gem install minitest` and add `gem 'minitest' to you test helper.
    from /Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.1.1/lib
/active_support/dependencies.rb:240:in `require'

我做了gem install minitest,现在它说将gem'minitest'添加到我的测试中帮手。这是 test/test_helper.rb 吗?如果是,我该如何“添加”minitest?

I am new to Ruby on Rails and testing. When I run rake test I get the following error:

/Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rack-1.3.4/lib/rack/backports
/uri/common_192.rb:53: warning: already initialized constant WFKV_
/Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/turn-0.8.3/lib/turn/autorun
/minitest.rb:14:in `<top (required)>': MiniTest v1.6.0 is out of date. (RuntimeError)
`gem install minitest` and add `gem 'minitest' to you test helper.
    from /Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.1.1/lib
/active_support/dependencies.rb:240:in `require'

I did gem install minitest and now it says to add gem 'minitest' to my test helper. Is this test/test_helper.rb, and if so, how do I "add" minitest?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

茶花眉 2024-12-17 05:59:34

编辑您的 Gemfile,以便在测试组下指定 gem,如下所示:

group :test do
  gem "minitest"
end

(将 OP 编辑​​的解决方案发布到问题中,但未将其作为答案发布)

Edit your Gemfile so that the gem is specified under the test group, like so:

group :test do
  gem "minitest"
end

(Posting the solution that the OP edited into the question, but did not post as an answer)

虐人心 2024-12-17 05:59:34

首先卸载您的 minitest。 gem 卸载迷你测试。

如果您使用turn,请确保版本低于0.8.3,

将这些代码放在 Gemfile 的底部,

group :test do
  gem 'turn', '< 0.8.3'
  gem 'minitest'
end

然后运行

bundle install 

uninstall your minitest first. gem uninstall minitest.

if you are using turn make sure the version is less 0.8.3

put those code to your bottom of your Gemfile

group :test do
  gem 'turn', '< 0.8.3'
  gem 'minitest'
end

then run

bundle install 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文