Use JSON.generate call in push update worker (#38208)
This commit is contained in:
@@ -23,10 +23,10 @@ class PushUpdateWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def message
|
def message
|
||||||
Oj.dump(
|
JSON.generate({
|
||||||
event: update? ? :'status.update' : :update,
|
event: update? ? :'status.update' : :update,
|
||||||
payload: @payload
|
payload: @payload,
|
||||||
)
|
}.as_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish!
|
def publish!
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ RSpec.describe PushUpdateWorker do
|
|||||||
|
|
||||||
context 'with valid records' do
|
context 'with valid records' do
|
||||||
let(:account) { Fabricate :account }
|
let(:account) { Fabricate :account }
|
||||||
let(:status) { Fabricate :status }
|
let(:status) { Fabricate :status, text: 'Test Post' }
|
||||||
|
|
||||||
before { allow(redis).to receive(:publish) }
|
before { allow(redis).to receive(:publish) }
|
||||||
|
|
||||||
@@ -25,7 +25,16 @@ RSpec.describe PushUpdateWorker do
|
|||||||
|
|
||||||
expect(redis)
|
expect(redis)
|
||||||
.to have_received(:publish)
|
.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
|
end
|
||||||
|
|
||||||
def redis_key
|
def redis_key
|
||||||
|
|||||||
Reference in New Issue
Block a user