views:

448

answers:

2

In other o/s RSpec returns nicely coloured results (red, green etc).

However in the windows (Vista) command prompt my text output is just plain old boring white.

How can I bring colour to my RSpec test results?

Thanks

Evolve

+2  A: 

You need to install the win32console gem. BTW: which version of RSpec are you using? Every single version of RSpec I have ever used, actually prints out

You must 'gem install win32console' to use colour on Windows

when you try to colorize output.

Jörg W Mittag
Yeah from my web searches they seemed to imply people were getting the above message, but I have not seen the above message myself. I am running the following versions; rspec 1.2.9 and rspec-rails 1.2.9 I've installed the win32console gem, spec results are still white. Do I need to change any settings to 'turn on' colour output?
Evolve
You have to pass the `--color` argument to the `spec` command.
Jörg W Mittag
That worked for my spec commands :)Also tried 'rake spec' and that was in color (as I think my default spec.opts file already has color option included)My spec.opts file is just the default of:--colour--format progress--loadby mtime--reverseIs it possible to configure the 'spec' command to have color on by default or is that why you use 'rake spec'? (Still new to RSpec)
Evolve
+1  A: 

Did you specify '--color' in your rake rspec tasks' spec_opts? Something like this..

  Spec::Rake::SpecTask.new(:your_task_name) do |t|
    t.spec_opts = ["--color"]
    t.spec_files = [] # List of spec files
  end
Selva