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)
|
FakeAutomation = Struct.new(:id)
|
||||||
|
|
||||||
let!(:automation) { FakeAutomation.new(1) }
|
let!(:automation) { FakeAutomation.new(1) }
|
||||||
|
let(:fake_logger) { FakeLogger.new }
|
||||||
|
|
||||||
around do |example|
|
before do
|
||||||
orig_logger = Rails.logger
|
SiteSetting.assign_enabled = true
|
||||||
Rails.logger = FakeLogger.new
|
Rails.logger.broadcast_to(fake_logger)
|
||||||
example.run
|
|
||||||
Rails.logger = orig_logger
|
|
||||||
end
|
end
|
||||||
|
|
||||||
before { SiteSetting.assign_enabled = true }
|
after { Rails.logger.stop_broadcasting_to(fake_logger) }
|
||||||
|
|
||||||
describe ".automation_script!" do
|
describe ".automation_script!" do
|
||||||
subject(:auto_assign) { described_class.automation_script!(ctx, fields, automation) }
|
subject(:auto_assign) { described_class.automation_script!(ctx, fields, automation) }
|
||||||
|
|
Loading…
Reference in New Issue