Convert mix of JSON.parse and JSON.load_file (#38242)
This commit is contained in:
1 parent
4d33490ec8
commit
b9d25bde3e
9 files changed
+18
-18
No files matched your search
@@ -65,7 +65,7 @@ RSpec.describe ActivityPub::Activity::QuoteRequest do
|
||||
expect { subject.perform }
|
||||
.to enqueue_sidekiq_job(ActivityPub::DeliveryWorker)
|
||||
.with(satisfying do |body|
|
||||
outgoing_json = Oj.load(body)
|
||||
outgoing_json = JSON.parse(body)
|
||||
outgoing_json['type'] == 'Reject' && %w(type id actor object instrument).all? { |key| json[key] == outgoing_json['object'][key] }
|
||||
end, recipient.id, sender.inbox_url)
|
||||
end
|
||||
@@ -78,7 +78,7 @@ RSpec.describe ActivityPub::Activity::QuoteRequest do
|
||||
expect { subject.perform }
|
||||
.to enqueue_sidekiq_job(ActivityPub::DeliveryWorker)
|
||||
.with(satisfying do |body|
|
||||
outgoing_json = Oj.load(body)
|
||||
outgoing_json = JSON.parse(body)
|
||||
outgoing_json['type'] == 'Reject' && json['instrument']['id'] == outgoing_json['object']['instrument'] && %w(type id actor object).all? { |key| json[key] == outgoing_json['object'][key] }
|
||||
end, recipient.id, sender.inbox_url)
|
||||
end
|
||||
@@ -95,7 +95,7 @@ RSpec.describe ActivityPub::Activity::QuoteRequest do
|
||||
.to change { quoted_post.reload.quotes.accepted.count }.by(1)
|
||||
.and enqueue_sidekiq_job(ActivityPub::DeliveryWorker)
|
||||
.with(satisfying do |body|
|
||||
outgoing_json = Oj.load(body)
|
||||
outgoing_json = JSON.parse(body)
|
||||
outgoing_json['type'] == 'Accept' && %w(type id actor object instrument).all? { |key| json[key] == outgoing_json['object'][key] }
|
||||
end, recipient.id, sender.inbox_url)
|
||||
end
|
||||
@@ -113,7 +113,7 @@ RSpec.describe ActivityPub::Activity::QuoteRequest do
|
||||
.to change { quoted_post.reload.quotes.accepted.count }.by(1)
|
||||
.and enqueue_sidekiq_job(ActivityPub::DeliveryWorker)
|
||||
.with(satisfying do |body|
|
||||
outgoing_json = Oj.load(body)
|
||||
outgoing_json = JSON.parse(body)
|
||||
outgoing_json['type'] == 'Accept' && json['instrument']['id'] == outgoing_json['object']['instrument'] && %w(type id actor object).all? { |key| json[key] == outgoing_json['object'][key] }
|
||||
end, recipient.id, sender.inbox_url)
|
||||
end
|
||||
|
||||
@@ -109,7 +109,7 @@ RSpec.describe 'Donation campaigns' do
|
||||
expect(Rails.cache.read("donation_campaign_request:#{seed}:en", raw: true))
|
||||
.to eq 'campaign-1:en'
|
||||
|
||||
expect(Oj.load(Rails.cache.read('donation_campaign:campaign-1:en', raw: true)))
|
||||
expect(JSON.parse(Rails.cache.read('donation_campaign:campaign-1:en', raw: true)))
|
||||
.to match(campaign_json)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
|
||||
],
|
||||
}
|
||||
end
|
||||
let(:json) { Oj.load(JSON.generate(payload)) }
|
||||
let(:json) { JSON.parse(JSON.generate(payload)) }
|
||||
|
||||
let(:alice) { Fabricate(:account) }
|
||||
let(:bob) { Fabricate(:account) }
|
||||
|
||||
@@ -161,8 +161,8 @@ class StreamingClient
|
||||
|
||||
def wait_for_message
|
||||
message = @connection.wait_for_event(:message)
|
||||
event = Oj.load(message)
|
||||
event['payload'] = Oj.load(event['payload']) if event['payload']
|
||||
event = JSON.parse(message)
|
||||
event['payload'] = JSON.parse(event['payload']) if event['payload']
|
||||
|
||||
event.deep_symbolize_keys
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user