2019-10-14 03:27:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-27 22:27:38 -04:00
|
|
|
RSpec.describe PrettyText::Helpers do
|
2019-10-14 03:27:33 -04:00
|
|
|
|
|
|
|
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
|