mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Don’t replace Rails logger in specs (#29721)
Instead of replacing the Rails logger in specs, we can instead use `#broadcast_to` which has been introduced in Rails 7.
This commit is contained in:
@@ -967,12 +967,12 @@ ensure
|
||||
end
|
||||
|
||||
def track_log_messages
|
||||
old_logger = Rails.logger
|
||||
logger = Rails.logger = FakeLogger.new
|
||||
logger = FakeLogger.new
|
||||
Rails.logger.broadcast_to(logger)
|
||||
yield logger
|
||||
logger
|
||||
ensure
|
||||
Rails.logger = old_logger
|
||||
Rails.logger.stop_broadcasting_to(logger)
|
||||
end
|
||||
|
||||
# this takes a string and returns a copy where 2 different
|
||||
|
||||
Reference in New Issue
Block a user