How to format rspec 2 output with rails 3

When I run rspec 2 with rails 3, I use

rake rspec 

Sometimes I would like to use a different formatter, perhaps a doc.

 rake rspec --format doc 

but unfortunately this parameter does not reach the rspec runner. How can I choose a different format when I run the command?

+6
ruby-on-rails ruby-on-rails-3 rake rspec2 formatter
source share
2 answers

You can add default parameters to the .rspec file in the rails root folder. eg.

 --colour --format documentation 
+12
source share

You can also skip the rake and use the rspec command directly. In this case, the -format option can be used to tell RSpec how to format the output, "documentation" (or "doc") and "progress" are valid parameters:

 rspec spec --format doc 

This is especially useful if you want to run a single test / spec file.

 rspec spec/models/your_model.rb --format doc 
0
source share

All Articles