In rails is it possible to get colour highlighting for the rake test command?

前端 未结 3 1616
梦如初夏
梦如初夏 2021-02-08 23:05

When running the rake test command from the terminal within a rails 3 project directory, the test result output is not coloured. Hence it cannot be interpreted at a gla

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-08 23:36

    Yes, you can use the redgreen gem. Include it in your gemfile:

    group :development, :test do
      gem 'redgreen'
    end
    

    And that's all you need for ruby 1.8. If you're using 1.9, there's a workaround. add the test-unit gem:

    group :development, :test do
      gem 'redgreen'
      gem 'test-unit', '1.2.3
    end
    

    It's not perfect with 1.9 - test-unit seems to run an empty test suite after every rake task or generator call, which is harmless but annoying.

提交回复
热议问题