[rspec-users] Color output in pagers

P. A.
2009-12-02T20:16:03Z

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.

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

Cheers!