Search code examples
rspecrspec-rails

Rspec pass configuration options in terminal command


I would like to pass config options when running rspec from terminal, as opposed to setting them in a file that rspec reads from.

My spec_helper specifies config.order='random', so I need to override this.

The use case is generating a command to use in a rake task (to generate documentation).

I've tried:

rspec spec/ --config.order default

but --config is an invalid option


Solution

  • Try:

    rspec spec --order default
    

    Generally most of the command line options take the form --<option-name> <value>. See rspec --help for the details.