How do I add gem 'minitest' to my test helper?

岁酱吖の 提交于 2019-12-09 04:32:08

问题


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?


回答1:


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)




回答2:


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 


来源:https://stackoverflow.com/questions/7779467/how-do-i-add-gem-minitest-to-my-test-helper

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!