From a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 16 Jun 2021 18:25:58 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-0-stable-ee --- spec/routing/project_routing_spec.rb | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'spec/routing/project_routing_spec.rb') diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 056f4d30ea5..fe04a1d7c4a 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -202,6 +202,16 @@ RSpec.describe 'project routing' do namespace_id: 'gitlab', project_id: 'gitlabhq', id: "stable", path: "new\n\nline.txt" }) end + + it_behaves_like 'redirecting a legacy path', '/gitlab/gitlabhq/refs/switch', '/gitlab/gitlabhq/-/refs/switch' + + it_behaves_like 'redirecting a legacy path', + '/gitlab/gitlabhq/refs/feature%2345/logs_tree', + '/gitlab/gitlabhq/-/refs/feature%2345/logs_tree' + + it_behaves_like 'redirecting a legacy path', + '/gitlab/gitlabhq/refs/stable/logs_tree/new%0A%0Aline.txt', + '/gitlab/gitlabhq/-/refs/stable/logs_tree/new%0A%0Aline.txt' end describe Projects::MergeRequestsController, 'routing' do @@ -310,9 +320,11 @@ RSpec.describe 'project routing' do expect(get('/gitlab/gitlabhq/-/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') end - it 'to #show from unscope routing' do - expect(get('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') + it 'to #raw from unscope routing' do + expect(get('/gitlab/gitlabhq/snippets/1/raw')).to route_to('projects/snippets#raw', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') end + + it_behaves_like 'redirecting a legacy path', '/gitlab/gitlabhq/snippets/1', '/gitlab/gitlabhq/-/snippets/1' end # test_project_hook POST /:project_id/-/hooks/:id/test(.:format) hooks#test @@ -357,9 +369,7 @@ RSpec.describe 'project routing' do expect(get('/gitlab/gitlabhq/-/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') end - it 'to #show unscoped routing' do - expect(get('/gitlab/gitlabhq/commit/4246fbd')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd') - end + it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/commit/4246fbd", "/gitlab/gitlabhq/-/commit/4246fbd" end # patch_project_commit GET /:project_id/commits/:id/patch(.:format) commits#patch @@ -376,9 +386,7 @@ RSpec.describe 'project routing' do expect(get('/gitlab/gitlabhq/-/commits/master.atom')).to route_to('projects/commits#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master.atom') end - it 'to #show unscoped routing' do - expect(get('/gitlab/gitlabhq/commits/master.atom')).to route_to('projects/commits#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master.atom') - end + it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/commits/master", "/gitlab/gitlabhq/-/commits/master" end # project_project_members GET /:project_id/project_members(.:format) project_members#index @@ -517,6 +525,7 @@ RSpec.describe 'project routing' do end it 'to #show from unscoped routing' do + expect(get('/gitlab/gitlabhq/tree/master')).to route_to('projects/tree#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master') expect(get('/gitlab/gitlabhq/tree/master/app/models/project.rb')).to route_to('projects/tree#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master/app/models/project.rb') end end @@ -545,6 +554,9 @@ RSpec.describe 'project routing' do namespace_id: 'gitlab', project_id: 'gitlabhq', id: "#{newline_file}" }) end + + it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/find_file", "/gitlab/gitlabhq/-/find_file" + it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/files/master", "/gitlab/gitlabhq/-/files/master" end describe Projects::BlobController, 'routing' do @@ -575,6 +587,9 @@ RSpec.describe 'project routing' do namespace_id: 'gitlab', project_id: 'gitlabhq', id: "master/docs/#{newline_file}" }) end + + it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/new/master", "/gitlab/gitlabhq/-/new/master" + it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/edit/master/README", "/gitlab/gitlabhq/-/edit/master/README" end # project_raw GET /:project_id/-/raw/:id(.:format) raw#show {id: /[^\0]+/, project_id: /[^\/]+/} @@ -610,6 +625,9 @@ RSpec.describe 'project routing' do expect(get('/gitlab/gitlabhq/-/compare/master...stable')).to route_to('projects/compare#show', namespace_id: 'gitlab', project_id: 'gitlabhq', from: 'master', to: 'stable') expect(get('/gitlab/gitlabhq/-/compare/issue/1234...stable')).to route_to('projects/compare#show', namespace_id: 'gitlab', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable') end + + it_behaves_like 'redirecting a legacy path', '/gitlab/gitlabhq/compare', '/gitlab/gitlabhq/-/compare' + it_behaves_like 'redirecting a legacy path', '/gitlab/gitlabhq/compare/master...stable', '/gitlab/gitlabhq/-/compare/master...stable' end describe Projects::NetworkController, 'routing' do -- cgit v1.2.3