mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-29 18:46:23 -05:00
31 lines
757 B
Ruby
31 lines
757 B
Ruby
|
require 'rails_helper'
|
||
|
require 'global_path'
|
||
|
|
||
|
class GlobalPathInstance
|
||
|
extend GlobalPath
|
||
|
end
|
||
|
|
||
|
describe GlobalPath do
|
||
|
|
||
|
context 'cdn_relative_path' do
|
||
|
def cdn_relative_path(p)
|
||
|
GlobalPathInstance.cdn_relative_path(p)
|
||
|
end
|
||
|
|
||
|
it "just returns path for no cdn" do
|
||
|
expect(cdn_relative_path("/test")).to eq("/test")
|
||
|
end
|
||
|
|
||
|
it "returns path when a cdn is defined with a path" do
|
||
|
GlobalSetting.expects(:cdn_url).returns("//something.com/foo")
|
||
|
expect(cdn_relative_path("/test")).to eq("/foo/test")
|
||
|
end
|
||
|
|
||
|
it "returns path when a cdn is defined with a path" do
|
||
|
GlobalSetting.expects(:cdn_url).returns("https://something.com:221/foo")
|
||
|
expect(cdn_relative_path("/test")).to eq("/foo/test")
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|