我剛剛超過了一個新項目,並且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