SPEC: 'lookup_upload_urls' method should use cdn url if available.

SPEC: ‘lookup_upload_urls’ method should use cdn url if available.

e4fe864c0b7d4d5d1f0cd604829eca81b71bb4ec

diff --git a/spec/components/pretty_text/helpers_spec.rb b/spec/components/pretty_text/helpers_spec.rb
new file mode 100644
index 0000000000..1f5c882cd1
--- /dev/null
+++ b/spec/components/pretty_text/helpers_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe PrettyText::Helpers do
+
+  context "lookup_upload_urls" do
+    let(:upload) { Fabricate(:upload) }
+
+    it "should return cdn url if available" do
+      short_url = upload.short_url
+      result = PrettyText::Helpers.lookup_upload_urls([short_url])
+      expect(result[short_url][:url]).to eq(upload.url)
+
+      set_cdn_url "https://awesome.com"
+
+      result = PrettyText::Helpers.lookup_upload_urls([short_url])
+      expect(result[short_url][:url]).to eq("https://awesome.com#{upload.url}")
+    end
+  end
+
+end

GitHub sha: 519fe290