tags:

views:

53

answers:

3

Hi all, I'm following the ruby on rails tutorial: http://railstutorial.org/chapters/static-pages#top

I'm up to using rspec. Having installed the win32console gem, it outputs gibberish in the console, i assume it is outputting the ansi colour 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 how to fix this?

+3  A: 

Ansicon works a treat!

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

Download, extract it somewhere, and do:

ansicon -i

Then close/reopen the command prompt. Sweet!

Chris
I had the exact same problem following this tutorial.
Daud
+1  A: 

There was a bug in beta releases of RSpec 2. If you upgrade to latest you should now see colors if you have win32console installed.

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

Lelon
Thanks for the update!
Chris
A: 

Update:

Rspec is still very buggy with windows coloring, especially if you're trying to use it with Autotest and/or Spork.

If you are still seeing escape codes, a quick hack is to edit the following file (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'
Lelon
Thanks for the effort mate, but i'm happy to simply use ansicon, lets face it win32 is always going to be second class for ruby development, so little hacks like ansicon are fine by me.
Chris