我正在关注Mhartl Ruby on Rails教程并开始使用Rspec。我想知道是否有办法解决我所假设的输出到cmd时没有正确编码的行尾字符,例如:←[0m
C:\PROGRAMMING\RailsSites\sample_app>bundle exec rspec spec/requests/static_pages_spec.rb
←[32m.←[0m←[32m.←[0m←[31mF←[0m
Failures:
1) Static Pages About page should have the content 'About Us'
←[31mFailure/Error:←[0m ←[31mvisit '/static_pages/about'←[0m
←[31mActionController::RoutingError:←[0m
←[31mNo route matches [GET] "/static_pages/about"←[0m
←[36m # ./spec/requests/static_pages_spec.rb:20:in `block (3 levels) in <top (required)>'←[0m
Finished in 3.66 seconds
←[31m3 examples, 1 failure←[0m
Failed examples:
←[31mrspec ./spec/requests/static_pages_spec.rb:19←[0m ←[36m# Static Pages About page should have the content 'About Us'←[0m
答案 0 :(得分:3)
这些是ANSI codes为文本着色。
运行rspec命令时,请传递--no-color
选项以禁用这些代码。您还可以将--no-color
添加到.rspec
文件中,使其成为项目的默认选项。
答案 1 :(得分:3)
试试这个:
ANSI Command Line Colors under Windows
它适用于我年迈的XP机器,它适用于博客作者的W7,它也可能适合你。它将我的cmd历史归结为BTW,但在第一次测试后看起来就像它的背部。