在命令行上运行测试时,通常会显示如下示例:
(See full trace by running task with --trace)
F
Failures:
1) Creating Post A user creates a new post
Failure/Error: visit '/'
ActionController::RoutingError:
No route matches [GET] "/"
# /home/user/.rvm/gems/ruby-2.3.3/gems/railties-5.0.3/lib/rails/rack/logger.rb:36:in `call_app'
# /home/user/.rvm/gems/ruby-2.3.3/gems/railties-5.0.3/lib/rails/rack/logger.rb:24:in `block in call'
# /home/user/.rvm/gems/ruby-2.3.3/gems/railties-5.0.3/lib/rails/rack/logger.rb:24:in `call'
# /home/user/.rvm/gems/ruby-2.3.3/gems/rack-2.0.2/lib/rack/method_override.rb:22:in `call'
....
是否可以通过配置设置或其他内容显示仅失败错误?所以测试只显示这个
F
Failures:
1) Creating Post A user creates a new post
Failure/Error: visit '/'
ActionController::RoutingError:
No route matches [GET] "/"
没有所有路径显示在底部。我认为有时候更容易发现错误
答案 0 :(得分:0)
有趣的是,我认为没有办法获得你想要的东西。起初,我相信你可以使用backtrace filtering,但显然when you filter everything, RSpec forces a full backtrace。
可悲的是,我能提供的最好的是:
$ rspec spec/models/customer_spec.rb | grep -Ev '^\s+# '
但是你输出的颜色会丢失。 = \