Peter Ehrlich
Peter Ehrlich

Reputation: 7115

Overly redundant rspec failure output

When I run rspec with fail fast, it gives me more output than I need. As you can see below, the one error is printed while running, and then printed again in summary. This is especially troublesome for when I'm doing a view test, when hundreds of lines of markup could be rendered twice in my console. Not fun at all.

Running tests with args ["--color", "--failure-exit-code", "2", "--format", "RSpec::Instafail", "--format", "Guard::RSpec::Formatter", "--require", "rspec/instafail", "--require", "/Users/peter/.rvm/gems/ruby-1.9.3-p429/gems/guard-rspec-3.0.0/lib/guard/rspec/formatter.rb", "spec/views/layouts/application.html.erb_spec.rb"]...
  1) layouts/application.html.erb will fail
     Failure/Error: raise  "An example error"
     RuntimeError:
       An example error
     # ./spec/views/layouts/application.html.erb_spec.rb:9:in `block (2 levels) in <top (required)>'


Failures:

  1) layouts/application.html.erb will fail
     Failure/Error: raise  "An example error"
     RuntimeError:
       An example error
     # ./spec/views/layouts/application.html.erb_spec.rb:9:in `block (2 levels) in <top (required)>'

Finished in 0.07728 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/views/layouts/application.html.erb_spec.rb:8 # layouts/application.html.erb will fail
]2;[RSpec results] 1 examples, 1 failures

Randomized with seed 6737

The first 6 lines are really important, and the next 16 become noise. How can I omit them? Thanks!

Upvotes: 1

Views: 287

Answers (1)

Peter Alfvin
Peter Alfvin

Reputation: 29389

I think you'll have to write your own, custom formatter. The example in the documentation may be less information that what you want, but it should give you a start.

Upvotes: 1

Related Questions