Remove unwanted triggers to `CookedPostProcessor` (#5319)

This commit is contained in:
Vinoth Kannan 2017-11-16 15:20:44 +05:30 committed by GitHub
parent 174ab2d93a
commit 6f2a3cb026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 6 deletions

View File

@ -15,6 +15,7 @@ describe Jobs::PullHotlinkedImages do
stub_request(:head, broken_image_url).to_return(status: 404) stub_request(:head, broken_image_url).to_return(status: 404)
stub_request(:get, large_image_url).to_return(body: large_png, headers: { "Content-Type" => "image/png" }) stub_request(:get, large_image_url).to_return(body: large_png, headers: { "Content-Type" => "image/png" })
stub_request(:head, large_image_url) stub_request(:head, large_image_url)
SiteSetting.crawl_images = true
SiteSetting.download_remote_images_to_local = true SiteSetting.download_remote_images_to_local = true
SiteSetting.max_image_size_kb = 2 SiteSetting.max_image_size_kb = 2
SiteSetting.download_remote_images_threshold = 0 SiteSetting.download_remote_images_threshold = 0
@ -96,10 +97,8 @@ describe Jobs::PullHotlinkedImages do
it 'replaces image src' do it 'replaces image src' do
post = Fabricate(:post, raw: "#{url}") post = Fabricate(:post, raw: "#{url}")
Jobs::ProcessPost.new.execute(post_id: post.id)
Jobs::PullHotlinkedImages.new.execute(post_id: post.id) Jobs::PullHotlinkedImages.new.execute(post_id: post.id)
Jobs::ProcessPost.new.execute(post_id: post.id) Jobs::ProcessPost.new.execute(post_id: post.id)
post.reload post.reload
expect(post.cooked).to match(/<img src=.*\/uploads/) expect(post.cooked).to match(/<img src=.*\/uploads/)
@ -113,7 +112,6 @@ describe Jobs::PullHotlinkedImages do
<a href='#{url}'><img src='#{large_image_url}'></a> <a href='#{url}'><img src='#{large_image_url}'></a>
") ")
Jobs::ProcessPost.new.execute(post_id: post.id)
Jobs::PullHotlinkedImages.new.execute(post_id: post.id) Jobs::PullHotlinkedImages.new.execute(post_id: post.id)
Jobs::ProcessPost.new.execute(post_id: post.id) Jobs::ProcessPost.new.execute(post_id: post.id)
Jobs::PullHotlinkedImages.new.execute(post_id: post.id) Jobs::PullHotlinkedImages.new.execute(post_id: post.id)
@ -131,7 +129,6 @@ describe Jobs::PullHotlinkedImages do
it 'broken image with placeholder' do it 'broken image with placeholder' do
post = Fabricate(:post, raw: "<img src='#{broken_image_url}'>") post = Fabricate(:post, raw: "<img src='#{broken_image_url}'>")
Jobs::ProcessPost.new.execute(post_id: post.id)
Jobs::PullHotlinkedImages.new.execute(post_id: post.id) Jobs::PullHotlinkedImages.new.execute(post_id: post.id)
post.reload post.reload
@ -141,9 +138,7 @@ describe Jobs::PullHotlinkedImages do
it 'large image with placeholder' do it 'large image with placeholder' do
post = Fabricate(:post, raw: "<img src='#{large_image_url}'>") post = Fabricate(:post, raw: "<img src='#{large_image_url}'>")
Jobs::ProcessPost.new.execute(post_id: post.id)
Jobs::PullHotlinkedImages.new.execute(post_id: post.id) Jobs::PullHotlinkedImages.new.execute(post_id: post.id)
Jobs::ProcessPost.new.execute(post_id: post.id)
post.reload post.reload
expect(post.cooked).to match(/<div class="large-image-placeholder"><a href=.*\ target="_blank" .*\>/) expect(post.cooked).to match(/<div class="large-image-placeholder"><a href=.*\ target="_blank" .*\>/)