Joel B Joel B - 2 years ago 242
Ruby Question

Can I set rspec --format documentation as the default?

Per the Rspec documentation, by default when you run

you get the progress formatter (looks like this: ".....").

There is another formatting option
rspec --format documentation
that goes through each test one by one. My question: how can I enable
--format documentation
by default without having to type it in the command line every time?

Answer Source

Option 1

Add it to .rspec file (or create one in the project's root directory) - options added to it will be applied to every test run within current project:

# .rspec
--format documentation

Option 2

Add it to RSpec.configure block:

RSpec.configure do |config|
  config.formatter = :documentation

Option 3

Specify rspec's options globally by adding them to ~/.rspec.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download