的Rails 3.2.1應用程序,使用MINITEST和自動測試護欄寶石。如何使用測試/單元MiniTest在自動測試中獲得彩色輸出?
如果我運行「耙測試」的輸出是彩色的。但是如果我運行自動測試,輸出不是彩色的。
如何使用自動測試時,我得到的彩色輸出?
這裏是我的test_helper.rb中:
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'turn/autorun'
Turn.config do |c|
# use one of output formats:
# :outline - turn's original case/test outline mode [default]
# :progress - indicates progress with progress bar
# :dotted - test/unit's traditional dot-progress mode
# :pretty - new pretty reporter
# :marshal - dump output as YAML (normal run mode only)
# :cue - interactive testing
c.format = :pretty
# turn on invoke/execute tracing, enable full backtrace
c.trace = true
# use humanized test names (works only with :outline format)
c.natural = true
end
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
end
這兩個環節似乎是死:( – alnorth29 2013-09-30 06:39:04
的職位超過12個月大的!對於這兩種技術中提到,無論是在這裏介紹的技術不工作了,但理論上是合理的,你必須在代碼中查找,或者詢問寶石作者是否有強制着色的方法,繞過檢查輸出是否爲tty。 – 2013-09-30 07:06:23