[rspec-users] Color output in pagers

P. A. lists at ruby-forum.com
Wed Dec 2 15:16:03 EST 2009

I solve it by myself.

To enable piping color output in Cucumber it needs to run the cucumber 
command with the -c option.

$ cucumber -c | less #=> color output

To enable piping color output in RSpec it needs to set the RSPEC_COLOR 
environment variable to true.

$ export RSPEC_COLOR=true
$ spec path/to/spec | less #=> color output

However, if RSPEC_COLOR is set to true the output to a file will include 
color tags. To prevent it, it needs to unset RSPEC_COLOR.

$ spec path/to/spec > file #=> no color tags

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list