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. I use Delayed::Worker.new.work_off to work off the events 开发者_如何学Cin my RSpec tests, but then the test out put gets littered with sh*t like:
[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...
精彩评论