You are writing a test.
It raises a well-known exception, and you check for it.
Suddenly, there’s log output, since you are working with some concurrent task. Your mood sinks. What’s the way to disable this library’s logging? In this case, I was kindly helped by the library’s author.
Console.logger in an RSpec test. Use an
around do |example| level = Console.logger.level Console.logger.off! example.run Console.logger.level = level end
First, store the existing level, in order to restore it after the test (aka example) has run.
Then, disable the logger and run the example.
Finally, restore the logger’s previous level.