Ruby Rspec displays alphabetic escape characters in windows

I follow the ruby โ€‹โ€‹on rails tutorial: http://railstutorial.org/chapters/static-pages#top

I am using rspec. Having installed the win32console gem, it outputs gibberish to the console, I assume that it displays ansi color change codes:

>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 

Any tips on how to fix this?

+4
source share
3 answers

Ansicon works with pleasure!

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

Download, extract it somewhere and run:

 ansicon -i 

Then close / reopen the command line. Cool!

+6
source

An error was detected in beta versions of RSpec 2. If you are updating to the latest, you should see the colors if you have installed win32console.

See this: http://github.com/rspec/rspec-core/issuesearch?state=closed&q=color#issue/143

UPDATE: Follow this thread:

http://groups.google.com/group/rubyinstaller/browse_thread/thread/2d2a62db7281509a/?pli=1

+2
source

Update:

Rspec still works very poorly with window coloring, especially if you are trying to use it with Autotest and / or Spork.

If you still see escape codes, a quick hack is to edit the next file (the exact path will depend on your version of RSpec)

% RUBY_HOME% \ lib \ ruby โ€‹โ€‹\ gems \ 1.9.1 \ gems \ RSpec-core-2.0.1 \ Bin \ RSpec

And add the following line

 require 'win32console' 
0
source

All Articles