Fix extremely slow topic_converter_spec

This commit is contained in:
Martin Brennan 2020-01-30 10:43:05 +10:00
parent 34f564acd6
commit bd04b9cbbe

View File

@ -124,6 +124,12 @@ describe TopicConverter do
:put,
"https://#{SiteSetting.s3_upload_bucket}.s3.amazonaws.com/original/1X/#{image_upload.sha1}.#{image_upload.extension}?acl"
)
# we need to do this otherwise we get infinite loop shenanigans, as the pull hotlinked
# images is never satisfied and keeps calling cooked post processor which in turn runs
# pull hotlinked images. we need jobs to run immediately for this spec to work correctly
# as the job to convert the uploads to secure must be run.
Jobs::PullHotlinkedImages.stubs(:new).returns(Helpers::StubbedJob.new)
end
it "converts regular uploads to secure when making a public post a PM" do
@ -131,11 +137,6 @@ describe TopicConverter do
public_reply.link_post_uploads
public_reply.update_uploads_secure_status
# we need to do this otherwise we get infinite loop shenanigans, as the pull hotlinked
# images is never satisfied and keeps calling cooked post processor which in turn runs
# pull hotlinked images
Jobs::PullHotlinkedImages.stubs(:new).returns(Helpers::StubbedJob.new)
expect(public_reply.uploads[0].secure).to eq(false)
public_topic.convert_to_private_message(admin)
expect(public_topic.reload.posts.find(public_reply.id).uploads[0].secure).to eq(true)