在rails中运行测试时如何处理此错误?

时间:2011-10-23 23:38:17

标签: ruby-on-rails minitest

使用ruby1.9.2 rails3.1.0

我正在使用我的上网本,所以这不是我通常的开发环境。我本周早些时候克隆了一个我在桌面上工作的回购。现在,当我运行rake test时,我在终端中收到此错误。

^[[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!

我按照说明操作gem install minitest,但仍然得到相同的结果。谁知道该怎么做?

我刚检查了我的宝石列表,它说安装了minitest版本2.6.2。我不知道为什么错误说MiniTest v1.6.0 is out of date我没有使用那个版本

3 个答案:

答案 0 :(得分:8)

我通过以下方式修复它: 在gem之后添加你的Gemfile,然后运行bundle install

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

答案 1 :(得分:4)

bundle exec rake test

在项目的根目录中有一个.rvmrc文件,可以方便地自动设置正确的ruby / gemset。还要确保您的Gemfile / Gemfile.lock使用的是正确的版本。

答案 2 :(得分:0)

以下是如何解决它...
转到你的应用程序的根目录并输入:
     gem install minitest
然后转到位于应用根目录中的gemfile并添加
     gem'minitest'位于文件底部。