使用我的第一台Mac进行开发,我发现即使我-c在命令中使用了' '标志,我的Rspec输出也没有在我的终端中着色:bundle exec rspec -c -fd.有任何想法吗?
fla*_*001 15
如果你从谷歌最近来到这里,你可能会注意到,艾伦春的回答给出了一个NoMethodError与.color_enabled使用RSpec的3.0或更高版本时..color_enabled已删除3.0:https://github.com/rspec/rspec-core/blob/master/Changelog.md#300rc1--2014-05-18
只要改变.color_enabled以.color在spec_helper.rb:
RSpec.configure do |config|
# Use color in STDOUT
config.color = true
# other config options here...
end
Run Code Online (Sandbox Code Playgroud)
这对我来说在OS X Mavericks 10.9.4上使用Ruby 2.1.2p95.
如果您不想在每次运行rspec时附加--color,也可以将配置放在spec_helper.rb上.
RSpec.configure do |config|
# Use color in STDOUT
config.color_enabled = true
# Use color not only in STDOUT but also in pagers and files
config.tty = true
# Use the specified formatter
config.formatter = :documentation # :progress, :html, :textmate
end
Run Code Online (Sandbox Code Playgroud)