ruby-on-rails - 如何抑制 RSpec 的失败输出?
问题描述
输出有 3 个部分:
Failures:
1) Spec name
Failure/Error: return ActiveRecord::Base.connection.exec_query(query_string) if Rails.env.test?
ActiveRecord::StatementInvalid:
PG::UndefinedFunction: ERROR: function group_concat(character varying, unknown) does not exist
LINE 1: SELECT ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
# ./app/models/...
# ./app/models/...
# ./app/models/...
# ------------------
# --- Caused by: ---
# PG::UndefinedFunction:
# ERROR: function group_concat(character varying, unknown) does not exist
# LINE 1: SELECT ... as...
# ^
# HINT: No function matches the given name and argument types. You might need to add explicit type casts.
# ./app/models/....rb:7:in `query'
Finished in 15.8 seconds (files took 12.76 seconds to load)
69 examples, 11 failures
Failed examples:
rspec ./spec/models/foo_spec.rb:385 # ...
rspec ./spec/models/foo_spec.rb:385 # ...
rspec ./spec/models/foo_spec.rb:385 # ...
失败的次数很多,我对失败的总数更感兴趣。
如何将输出限制为:
Finished in 15.8 seconds (files took 12.76 seconds to load)
69 examples, 11 failures
解决方案
不是我正在寻找的答案,但这很好用:
rspec | grep examples
推荐阅读
- php - 错误 413:使用 PHP 请求实体太大
- ajax - 断开连接后django通道无效状态错误
- java - Spring Boot 在模块化 Java 中配置 DevTools
- python - 如何在 python 脚本中获取多个分页 api?
- nginx - nginx: [emerg] "server" 指令在 /etc/nginx/nginx.conf 中是不允许的
- c++ - 使用 C++ 重新启动 explorer.exe
- javascript - 用于删除输入字段的 jQuery 问题
- go - 以并发模式订阅 Podio Push 服务时出现 4xx 错误
- r - 在 R 包中包含和使用预编译的 .dll / .so
- sql - 根据第一个表中的值计算第二个表中的记录数