[英]How do I silence the delayed_job output in test?
I am using delayed_job for background tasks such as system e-mails and different timed events. 我正在将delay_job用于后台任务,例如系统电子邮件和不同的定时事件。 I use Delayed::Worker.new.work_off to work off the events in my RSpec tests, but then the test out put gets littered with sh*t like: 我使用Delayed :: Worker.new.work_off来处理我的RSpec测试中的事件,但是随后测试输出被sh * t乱扔了,例如:
[Worker(host:ch.local pid:24307)] RPM Monitoring DJ worker host:ch.local pid:24307
[Worker(host:ch.local pid:24307)] acquired lock on ListingJob
[Worker(host:ch.local pid:24307)] ListingJob completed after 0.0655
I get that the output is helpful for debugging, but is there a way to silence it? 我知道输出对调试很有帮助,但是有没有办法使它静音? I would much rather enable it when a test fails to debug, rather than always have it on. 我宁愿在测试无法调试时启用它,也不要总是启用它。
Thanks. 谢谢。
Try this: 尝试这个:
worker = Delayed::Worker.new(:max_priority => nil,
:min_priority => nil,
:quiet => true
)
worker.work_off
By telling the worker to be quiet it should clean up the spam... 通过告诉工人保持安静,应该清理垃圾邮件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.