Use JSON.generate call in push update worker (#38208)

This commit is contained in:
Matt Jankowski
2026-03-16 09:55:53 -04:00
committed by GitHub
parent 21c27eb3af
commit f9b2dffaa8
2 changed files with 14 additions and 5 deletions

View File

@@ -23,10 +23,10 @@ class PushUpdateWorker
end
def message
Oj.dump(
JSON.generate({
event: update? ? :'status.update' : :update,
payload: @payload
)
payload: @payload,
}.as_json)
end
def publish!

View File

@@ -15,7 +15,7 @@ RSpec.describe PushUpdateWorker do
context 'with valid records' do
let(:account) { Fabricate :account }
let(:status) { Fabricate :status }
let(:status) { Fabricate :status, text: 'Test Post' }
before { allow(redis).to receive(:publish) }
@@ -25,7 +25,16 @@ RSpec.describe PushUpdateWorker do
expect(redis)
.to have_received(:publish)
.with(redis_key, anything)
.with(
redis_key,
match_json_values(
event: 'update',
payload: include(
created_at: status.created_at.iso8601(3),
content: eq('<p>Test Post</p>')
)
)
)
end
def redis_key