fix the incorrect specs
Previously the 'local_cdn_url' method didn't returned the correct cdn url. So we written few incorrect spec tests too.\n\nf92a6f7ac5228342177bf089d269e2f69a69e2f5
This commit is contained in:
parent
815edf6f4d
commit
129e308dac
|
@ -1378,21 +1378,23 @@ HTML
|
|||
[some attachment|random](#{upload.short_url})
|
||||
RAW
|
||||
|
||||
cdn_url = Discourse.store.cdn_url(upload.url)
|
||||
|
||||
cooked = <<~HTML
|
||||
<p><img src="#{upload.url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
<p><img src="#{upload.url}" alt="upload" title="some title to test" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
<p><img src="#{cdn_url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
<p><img src="#{cdn_url}" alt="upload" title="some title to test" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><img src="#{upload.url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
<p><img src="#{cdn_url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>test</p>
|
||||
<ul>
|
||||
<li><img src="#{upload.url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></li>
|
||||
<li><img src="#{cdn_url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p><img src="#{upload.url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
<p><img src="#{cdn_url}" alt="upload" data-base62-sha1="#{upload.base62_sha1}"></p>
|
||||
<p><a href="#{upload.short_path}">some attachment</a></p>
|
||||
<p><a class="attachment" href="#{upload.short_path}">some attachment</a></p>
|
||||
<p><a href="#{upload.short_path}">some attachment|random</a></p>
|
||||
|
|
|
@ -124,7 +124,7 @@ describe UrlHelper do
|
|||
let(:asset_host) { "//my.awesome.cdn" }
|
||||
|
||||
it "should return correct cdn url for local relative urls" do
|
||||
Discourse.stubs(:asset_host).returns(asset_host)
|
||||
set_cdn_url asset_host
|
||||
cdn_url = UrlHelper.local_cdn_url(url)
|
||||
expect(cdn_url).to eq("#{asset_host}#{url}")
|
||||
end
|
||||
|
|
|
@ -1367,6 +1367,7 @@ describe Post do
|
|||
upload1 = Fabricate(:upload)
|
||||
upload2 = Fabricate(:upload)
|
||||
upload3 = Fabricate(:video_upload)
|
||||
upload4 = Fabricate(:upload)
|
||||
|
||||
set_cdn_url "https://awesome.com/somepath"
|
||||
|
||||
|
@ -1375,7 +1376,7 @@ describe Post do
|
|||
|
||||
![](#{upload1.short_url})
|
||||
|
||||
"#{GlobalSetting.cdn_url}#{upload1.url}"
|
||||
"#{GlobalSetting.cdn_url}#{upload4.url}"
|
||||
|
||||
<a href='#{Discourse.base_url}#{upload2.url}'>Link to upload</a>
|
||||
![](http://example.com/external.png)
|
||||
|
@ -1392,15 +1393,15 @@ describe Post do
|
|||
end
|
||||
|
||||
expect(urls).to contain_exactly(
|
||||
upload1.url,
|
||||
"#{GlobalSetting.cdn_url}#{upload1.url}",
|
||||
"#{GlobalSetting.cdn_url}#{upload4.url}",
|
||||
"#{Discourse.base_url}#{upload2.url}",
|
||||
"#{Discourse.base_url}#{upload3.short_path}"
|
||||
)
|
||||
|
||||
expect(paths).to contain_exactly(
|
||||
upload1.url,
|
||||
upload1.url,
|
||||
upload4.url,
|
||||
upload2.url,
|
||||
nil
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue