From 45db98dd3e7ac65e9bd9f0ff61a33ca23b7418fd Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 25 Feb 2019 15:21:33 -0500 Subject: [PATCH] FIX: Heisentest - Stored uploads don't always start with 1X This is a common pattern we see in tests. The `id` of the upload is used to create the URL and we assume the `id` will always be in a certain range which depends on the database. --- spec/components/cooked_post_processor_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rb index 5f7801ded91..cb17f33a8a1 100644 --- a/spec/components/cooked_post_processor_spec.rb +++ b/spec/components/cooked_post_processor_spec.rb @@ -1019,7 +1019,8 @@ describe CookedPostProcessor do extension: "png", ) - upload.update_column(:url, "#{SiteSetting.Upload.absolute_base_url}/#{Discourse.store.get_path_for_upload(upload)}") + stored_path = Discourse.store.get_path_for_upload(upload) + upload.update_column(:url, "#{SiteSetting.Upload.absolute_base_url}/#{stored_path}") the_post = Fabricate(:post, raw: %Q{This post has a local emoji :+1: and an external upload\n\n![smallest.png|10x20](#{upload.short_url})}) @@ -1028,7 +1029,7 @@ describe CookedPostProcessor do expect(cpp.html).to match_html <<~HTML

This post has a local emoji :+1: and an external upload

-

smallest.png

+

smallest.png

HTML end