How do I globally configure RSpec to keep the '--color' and '--format specdoc' options turned on

前端 未结 6 832
日久生厌
日久生厌 2020-12-22 17:42

How do I set global configuration for RSpec in Ubuntu.

Specifically so, --color and --format specdoc stay turned on, across all my projects (ie every time I run rspe

6条回答
  •  悲哀的现实
    2020-12-22 18:16

    One can also use a spec_helper.rb file in all projects. The file should include the following:

    RSpec.configure do |config|
      # Use color in STDOUT
      config.color = true
    
      # Use color not only in STDOUT but also in pagers and files
      config.tty = true
    
      # Use the specified formatter
      config.formatter = :documentation # :progress, :html,
                                        # :json, CustomFormatterClass
    end
    

    Any example file must require the helper to be able to use that options.

提交回复
热议问题