| ... | @@ -5,6 +5,40 @@ describe API::Helpers::RelatedResourcesHelpers do |
... | @@ -5,6 +5,40 @@ describe API::Helpers::RelatedResourcesHelpers do |
|
|
Class.new.include(described_class).new
|
|
Class.new.include(described_class).new
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
describe '#expose_path' do
|
|
|
|
let(:path) { '/api/v4/awesome_endpoint' }
|
|
|
|
|
|
|
|
context 'empty relative URL root' do
|
|
|
|
before do
|
|
|
|
stub_config_setting(relative_url_root: '')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the existing path' do
|
|
|
|
expect(helpers.expose_path(path)).to eq(path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'slash relative URL root' do
|
|
|
|
before do
|
|
|
|
stub_config_setting(relative_url_root: '/')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the existing path' do
|
|
|
|
expect(helpers.expose_path(path)).to eq(path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with relative URL root' do
|
|
|
|
before do
|
|
|
|
stub_config_setting(relative_url_root: '/gitlab/root')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the existing path' do
|
|
|
|
expect(helpers.expose_path(path)).to eq("/gitlab/root" + path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
describe '#expose_url' do
|
|
describe '#expose_url' do
|
|
|
let(:path) { '/api/v4/awesome_endpoint' }
|
|
let(:path) { '/api/v4/awesome_endpoint' }
|
|
|
subject(:url) { helpers.expose_url(path) }
|
|
subject(:url) { helpers.expose_url(path) }
|
| ... | |
... | |
| ... | | ... | |