1

当我以失败快速运行 rspec 时,它给了我比我需要的更多的输出。正如您在下面看到的,在运行时会打印一个错误,然后在摘要中再次打印。当我进行视图测试时,这尤其麻烦,因为数百行标记可以在我的控制台中呈现两次。一点都不好玩。

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

前 6 行非常重要,接下来的 16 行成为噪音。我怎样才能省略它们?谢谢!

4

1 回答 1

1

我认为您必须编写自己的自定义格式化程序。文档中的示例可能比您想要的信息少,但它应该给您一个开始

于 2013-08-01T16:50:32.277 回答