diff options
author | Rémy Coutable <remy@rymai.me> | 2019-05-07 14:52:04 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-05-07 14:52:04 +0000 |
commit | ed823c356f3875bf499b12aef29d3fe061b5a666 (patch) | |
tree | cb81aa2d51bb859da25f27089bb27a75ed367f3c /spec | |
parent | 5c07f932bb7f99f231d83351e9a0f500d98074a2 (diff) | |
parent | 58c09eb70941a0954fb5cd7b0c6316c698353edb (diff) | |
download | gitlab-ce-ed823c356f3875bf499b12aef29d3fe061b5a666.tar.gz |
Merge branch 'sh-fix-related-merge-requests-path' into 'master'
Use a path for the related merge requests endpoint
Closes #61280
See merge request gitlab-org/gitlab-ce!28171
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/api/helpers/related_resources_helpers_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/lib/api/helpers/related_resources_helpers_spec.rb b/spec/lib/api/helpers/related_resources_helpers_spec.rb index 66af7f81535..99fe8795d91 100644 --- a/spec/lib/api/helpers/related_resources_helpers_spec.rb +++ b/spec/lib/api/helpers/related_resources_helpers_spec.rb @@ -5,6 +5,40 @@ describe API::Helpers::RelatedResourcesHelpers do Class.new.include(described_class).new 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 let(:path) { '/api/v4/awesome_endpoint' } subject(:url) { helpers.expose_url(path) } |