Ruby Rspec在Windows上输出文字转义字符

Chr*_*ris 4 ruby rspec ansi

我正在关注ruby on rails教程:http://railstutorial.org/chapters/static-pages#top

我正在使用rspec.安装了win32console gem之后,它会在控制台中输出乱码,我假设它正在输出ansi颜色更改代码:

>rspec spec/
?[31mF?[0m?[31mF?[0m

Finished in 0.34376 seconds
?[31m2 examples, 2 failures?[0m

1) PagesController GET 'home' should be successful
    Failure/Error: Unable to find C to read failed line
    ?[31mundefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x22294e0>?[0m
?[90m    # ./spec/controllers/pages_controller_spec.rb:7:in `block (3 levels) in <top (required)>'?[0m

2) PagesController GET 'contact' should be successful
    Failure/Error: Unable to find C to read failed line
    ?[31mundefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_2:0x2173d28>?[0m
?[90m    # ./spec/controllers/pages_controller_spec.rb:14:in `block (3 levels) in <top (required)>'?[0m
Run Code Online (Sandbox Code Playgroud)

任何提示如何解决这个问题?

Chr*_*ris 6

Ansicon是一种享受!

http://adoxa.110mb.com/ansicon/index.html

下载,将其解压缩到某处,并执行:

ansicon -i
Run Code Online (Sandbox Code Playgroud)

然后关闭/重新打开命令提示符.甜!