Getting RSpec to report intermediate failures
Is there a way 开发者_如何转开发to get RSpec to report failures as they occur, instead of the long list of green/red dots? I'm running RSpec 2.5.0.
RSpec supports multiple output formats, specified with the --format
option. The default is "progress", the string of dots you're seeing. If you change to a more verbose format, you'll see the name of the test in red/green as you run, but you still won't see what the failure was until the summary that's printed at the end.
The other format options, from running rspec --help
are:
-f, --format FORMATTER Choose a formatter
[p]rogress (default - dots)
[d]ocumentation (group and example names)
[h]tml
[t]extmate
custom formatter class name
In addition to specifying format on the command line, you can put a ".rspec" file in your home directory to specify default options.
Use a different format, such as --format documentation
.
You can pass it as argument to the CLI.
$ rspec spec/ --format documentation
You may take a look at the different formatters out there. I guess the one you are looking for is FailingExamplesFormatter
to be run just like this:
spec spec --require spec/runner/formatter/failing_examples_formatter.rb --formatter FailingExamplesFormatter
精彩评论