如何抑制/禁用“高速缓存未命中”在 Rails 3.1 中运行 rspec 测试时的消息
运行 request rspec 规范时,我开始看到以下输出:
cache: [GET /login] miss
cache: [GET /javascripts/jquery.min.js?1317513028] miss
通常,我会得到绿点表示通过测试,得到红色 F 以及一些错误消息信息。
有没有办法禁用输出中的缓存未命中消息?
I'm starting to see the following output when running request rspec specs:
cache: [GET /login] miss
cache: [GET /javascripts/jquery.min.js?1317513028] miss
Normaly I would get green dots for passing tests and red Fs with some info for error messages.
Is there a way to disable the cache miss messages from the output?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这与 rspec 无关,rspec 只是打印出 Rails 日志中的内容。我认为 Phusion Passenger 讨论组中 Brian Weaver 发布的帖子可能会给出答案你的问题:
就您而言,我想您想将其添加到您的测试环境文件中。
I think this has nothing to do with rspec and that rspec is just printing out what is in the rails log. I think this post by Brian Weaver on the Phusion Passenger discussion group might answer your question:
In your case, I guess you want to add it your your test environment file.
除了 @RyanTM 之外,您还需要为测试环境打开缓存,以便 DragonFly 不会配置自己的 Rack::Cache (使用 :verbose => true),而是使用 Rails 的设置。
In addition to @RyanTM you also need to turn caching on for the test environment so that DragonFly does not configure its own Rack::Cache (with :verbose => true) but instead uses the one setup by Rails.
我无法让上述任何一种解决方法为我工作,但将其添加到我的 'config/initializers/dragonfly.rb' 中有效:
I couldn't get either of the above workarounds to work for me, but adding this to my 'config/initializers/dragonfly.rb' worked: