我刚刚超过了一个新项目,并且rake test
产生了很多乱码输出。为什么会这样?我试着去除了所有我不知道的宝石,但我的输出仍然是阴云密布。我通过bundle exec rake test
致电测试套件。我的滑轨测试会产生乱码输出
示例输出 - 它是这类东西的页面。
/Users/hendricius/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.5/lib/active_support/file_update_checker.rb:98: warning: File.exists? is a deprecated name,
use File.exist? instead
/Users/hendricius/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.5/lib/active_support/file_update_checker.rb:98: warning: File.exists? is a deprecated name,
use File.exist? instead
/Users/hendricius/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.5/lib/active_support/file_update_checker.rb:98: warning: File.exists? is a deprecated name,
use File.exist? instead
/Users/hendricius/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-3.2.22.5/lib/active_support/file_update_checker.rb:98: warning: File.exists? is a deprecated name,
use File.exist? instead
从.ruby-version
文件红宝石版本是2.2.2
。安装的导轨版本是3.2.22.5
。
我的测试宝石:
group :test, :development do
# gem 'rack-mini-profiler'
# gem 'minitest'
gem 'minitest-rails'
gem 'test-unit'
gem 'shoulda'
gem 'shoulda-matchers'
gem 'fabrication'
gem 'byebug'
end
然后我双重检查我的Rakefile
。它具有以下内容:
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
WooWoop::Application.load_tasks
task default: [:test]
我唯一能想象的其他事情就是我的test_helper
。我粘贴下面的内容。看上去不错。
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "minitest/rails"
require "minitest/pride"
require 'shoulda'
require 'shoulda/matchers'
# $VERBOSE=nil
# ActiveRecord::Migration.check_pending!
ActiveSupport::TestCase.test_order = :random
# Protractor test or even some dirty debugging in the rails console on test environment
# might have left some garbage on the DB. Lets make sure we start with a clean state.
# parses the response and returns it.
我可以沉默输出的唯一方法是,如果我用RUBYOPT=W0 TEST=test/unit/shop_test.rb be rake test
。这是自从我使用rails 3以来唯一的方法吗?
更新:
我现在想降级到2.0.0红宝石
我还是得到了很多奇怪的警告,我以前从未见过的。
/Users/hendricius/.rbenv/versions/2.0.0-p648/lib/ruby/gems/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:89: warning: instance variable @mount_on not in
itialized
/Users/hendricius/.rbenv/versions/2.0.0-p648/lib/ruby/gems/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/mount.rb:243: warning: instance variable @previous_model_for_showcase_cov
er_picture not initialized
/Users/hendricius/.rbenv/versions/2.0.0-p648/lib/ruby/gems/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:89: warning: instance variable @mount_on not in
itialized
/Users/hendricius/.rbenv/versions/2.0.0-p648/lib/ruby/gems/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/mount.rb:243: warning: instance variable @previous_model_for_manager_pict
ure not initialized
(eval):11: warning: instance variable @opening_hours_monday_from not initialized
(eval):2: warning: instance variable @opening_hours_monday_to not initialized
(eval):11: warning: instance variable @opening_hours_tuesday_from not initialized
(eval):2: warning: instance variable @opening_hours_tuesday_to not initialized
(eval):11: warning: instance variable @opening_hours_wednesday_from not initialized
(eval):2: warning: instance variable @opening_hours_wednesday_to not initialized
(eval):11: warning: instance variable @opening_hours_thursday_from not initialized
(eval):2: warning: instance variable @opening_hours_thursday_to not initialized
(eval):11: warning: instance variable @opening_hours_friday_from not initialized
(eval):2: warning: instance variable @opening_hours_friday_to not initialized
(eval):11: warning: instance variable @opening_hours_saturday_from not initialized
(eval):2: warning: instance variable @opening_hours_saturday_to not initialized
编辑:
我最终结束了升级到轨4.所有的警告都没有了。
之前的项目使用哪个Ruby版本?你为什么不使用与原始项目相同的版本?不要为自己创造比你需要创造更多的麻烦。 – Casper
这是'2.0.0-p481'。我会给你一个镜头。 – Hendrik
我记得现在为什么我升级了:'警告:ruby-2.0.0-p481已经过了它的使用寿命,现在不受支持。 它不再收到错误修复或重要的安全更新。“ – Hendrik