的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