Testing 在Rails3.1中仍然收到弃用警告

Testing 在Rails3.1中仍然收到弃用警告,testing,ruby-on-rails-3.1,Testing,Ruby On Rails 3.1,在Rails 3.1中进行测试时,我不断收到折旧警告,比如 RailsProject$ bundle exec autotest NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. Gem.source_index called from /Users/CS/.rvm/gems/ruby-1.9.2-p290/gems/Zen

在Rails 3.1中进行测试时,我不断收到折旧警告,比如

    RailsProject$ bundle exec autotest
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
    Gem.source_index called from /Users/CS/.rvm/gems/ruby-1.9.2-p290/gems/ZenTest-4.5.0/lib/autotest.rb:226.
    NOTE: Gem::SourceIndex#gems is deprecated with no replacement. It will be removed on or after 2011-11-01.
    Gem::SourceIndex#gems called from /Users/CS/.rvm/gems/ruby-1.9.2-p290/gems/ZenTest-4.5.0/lib/autotest.rb:226.
    loading autotest/rails
    /Users/CS/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -I.:lib:test -rubygems -e "%w[test/unit test/unit/rim_test.rb test/unit/page_test.rb test/functional/pages_controller_test.rb test/unit/helpers/pages_helper_test.rb test/unit/order_test.rb test/unit/admin_user_test.rb test/unit/helpers/cart_helper_test.rb test/unit/customer_test.rb test/unit/ordered_service_test.rb test/unit/services_test.rb test/functional/cart_controller_test.rb].each { |f| require f }" | unit_diff -u
    /Users/CS/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/rubygems_ext.rb:43: warning: method redefined; discarding old gem_dir
    /Users/CS/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1262: warning: previous definition of gem_dir was here
    /Users/CS/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/rubygems_ext.rb:154: warning: method redefined; discarding old hash
    /Users/CS/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/platform.rb:125: warning: previous definition of hash was here
    /Users/CS/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:183: warning: method redefined; discarding old initialize
    /Users/CS/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb:53: warning: previous definition of initialize was here
我的版本:

    RailsProject$ bundle exec rails -v
    Rails 3.1.0
    RailsProject$ bundle exec gem -v
    1.8.10
    RailsProject$ bundle exec bundle -v
    Bundler version 1.0.18
我尝试了所有的
gem pristine--all--no-extensions
东西,无论是否使用
bundle exec

每一块宝石都是最新的


有人知道如何解决这个问题吗?

问题是您没有使用最新版本的ZenTest。您使用的是4.5.0,最新版本是4.6.2

试着跑步

gem update ZenTest
gem update autotest

您可能需要在rails应用程序中更新您的Gemfile,并运行
bundle install
以将Gemfile锁定到最新版本的gems。

您需要安装ZenTest 4.6.2。 如果您使用rails 3.1,您会发现 自动测试轨道(4.1.1)依赖于ZenTest(=4.5.0)。 只需修改Gemfile.lock,搜索ZenTest,将其更改为使用4.6.2,然后更改

autotest (4.4.6)
  ZenTest (= 4.5.0)

然后,跑

bundle install

仅此而已。

bundle exec gem update ZenTest
以某种方式将ZenTest更新为4.6.2,但尽管我安装了
bundle,rake似乎仍然使用4.5(警告仍然存在)。我必须在Gemfile中指定ZenTest吗?
$bundle exec gem list ZenTest
产生:
***本地GEMS***ZenTest(4.5.0)
Aah,我知道问题的原因了。在GEM文件中指定Zentest 4.6.2后,我得到:
autotestRails取决于Zentest(=4.5)
bundle install