DEV: Don’t replace Rails logger in specs
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:
parent
f76c30dbb7
commit
964e44a63e
|
@ -7,15 +7,14 @@ RSpec.describe RandomAssignUtils do
|
|||
FakeAutomation = Struct.new(:id)
|
||||
|
||||
let!(:automation) { FakeAutomation.new(1) }
|
||||
let(:fake_logger) { FakeLogger.new }
|
||||
|
||||
around do |example|
|
||||
orig_logger = Rails.logger
|
||||
Rails.logger = FakeLogger.new
|
||||
example.run
|
||||
Rails.logger = orig_logger
|
||||
before do
|
||||
SiteSetting.assign_enabled = true
|
||||
Rails.logger.broadcast_to(fake_logger)
|
||||
end
|
||||
|
||||
before { SiteSetting.assign_enabled = true }
|
||||
after { Rails.logger.stop_broadcasting_to(fake_logger) }
|
||||
|
||||
describe ".automation_script!" do
|
||||
subject(:auto_assign) { described_class.automation_script!(ctx, fields, automation) }
|
||||
|
|
Loading…
Reference in New Issue