What do I do with this error when I run tests in rails?

孤街浪徒 提交于 2020-01-15 03:42:09

问题


using ruby1.9.2 rails3.1.0

I am working from my netbook, so it is not my usual dev environment. I cloned a repo that I was working with on my desktop early this week. Now when I run rake test I get this error in the terminal.

^[[1;5C/home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
/home/work/.rvm/gems/ruby-1.9.2-p290@rails310/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 /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/turn-0.8.3/lib/turn.rb:13:in `<top (required)>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/test_help.rb:19:in `<top (required)>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/Desktop/sa_clubbing/test/test_helper.rb:3:in `<top (required)>'
    from /home/work/Desktop/sa_clubbing/test/unit/blog_post_test.rb:1:in `require'
    from /home/work/Desktop/sa_clubbing/test/unit/blog_post_test.rb:1:in `<top (required)>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `block (2 levels) in <main>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `each'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:5:in `each'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:5:in `<main>'
/home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
/home/work/.rvm/gems/ruby-1.9.2-p290@rails310/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 /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/turn-0.8.3/lib/turn.rb:13:in `<top (required)>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/test_help.rb:19:in `<top (required)>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/work/Desktop/sa_clubbing/test/test_helper.rb:3:in `<top (required)>'
    from /home/work/Desktop/sa_clubbing/test/functional/landing_page_controller_test.rb:1:in `require'
    from /home/work/Desktop/sa_clubbing/test/functional/landing_page_controller_test.rb:1:in `<top (required)>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `require'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `block (2 levels) in <main>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `each'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:5:in `each'
    from /home/work/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:5:in `<main>'
Errors running test:units, test:functionals!

I followed the instruction and did gem install minitest , but still get the same result. Anyone know what to do here?

I just checked my gem list and it says minitest version 2.6.2 is installed. I don't know why the error is saying MiniTest v1.6.0 is out of date I am not using that version


回答1:


bundle exec rake test

Having a .rvmrc file in the project's root directory is handy for automatically setting the correct ruby/gemset. Also make sure your Gemfile/Gemfile.lock are using the correct version.




回答2:


I fixed it in the following way: add in your Gemfile following gem, Then run bundle install

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



回答3:


Here is how to fix it...
go to the root of your aplication and type:
gem install minitest
Then go to your gemfile located in the root of your app and add
gem 'minitest' at the bottom of the file.



来源:https://stackoverflow.com/questions/7870074/what-do-i-do-with-this-error-when-i-run-tests-in-rails

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