diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/routing | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/routing')
-rw-r--r-- | spec/routing/project_routing_spec.rb | 34 | ||||
-rw-r--r-- | spec/routing/routing_spec.rb | 28 |
2 files changed, 30 insertions, 32 deletions
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 diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 7b9ba783885..e7ea5b79897 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -96,9 +96,11 @@ RSpec.describe SnippetsController, "routing" do expect(get("/-/snippets/1")).to route_to('snippets#show', id: '1') end - it 'to #show from unscoped routing' do - expect(get("/snippets/1")).to route_to('snippets#show', id: '1') + it 'to #raw from unscoped routing' do + expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1') end + + it_behaves_like 'redirecting a legacy path', '/snippets/1', '/-/snippets/1' end # help GET /help(.:format) help#index @@ -132,12 +134,10 @@ RSpec.describe ProfilesController, "routing" do it "to #account" do expect(get("/-/profile/account")).to route_to('profiles/accounts#show') end - it_behaves_like 'redirecting a legacy path', '/profile/account', '/-/profile/account' it "to #audit_log" do expect(get("/-/profile/audit_log")).to route_to('profiles#audit_log') end - it_behaves_like 'redirecting a legacy path', '/profile/audit_log', '/-/profile/audit_log' it "to #reset_feed_token" do expect(put("/-/profile/reset_feed_token")).to route_to('profiles#reset_feed_token') @@ -146,7 +146,6 @@ RSpec.describe ProfilesController, "routing" do it "to #show" do expect(get("/-/profile")).to route_to('profiles#show') end - it_behaves_like 'redirecting a legacy path', '/profile', '/-/profile' end # profile_preferences GET /-/profile/preferences(.:format) profiles/preferences#show @@ -156,7 +155,6 @@ RSpec.describe Profiles::PreferencesController, 'routing' do it 'to #show' do expect(get('/-/profile/preferences')).to route_to('profiles/preferences#show') end - it_behaves_like 'redirecting a legacy path', '/profile/preferences', '/-/profile/preferences' it 'to #update' do expect(put('/-/profile/preferences')).to route_to('profiles/preferences#update') @@ -174,7 +172,6 @@ RSpec.describe Profiles::KeysController, "routing" do it "to #index" do expect(get("/-/profile/keys")).to route_to('profiles/keys#index') end - it_behaves_like 'redirecting a legacy path', '/profile/keys', '/-/profile/keys' it "to #create" do expect(post("/-/profile/keys")).to route_to('profiles/keys#create') @@ -183,7 +180,6 @@ RSpec.describe Profiles::KeysController, "routing" do it "to #show" do expect(get("/-/profile/keys/1")).to route_to('profiles/keys#show', id: '1') end - it_behaves_like 'redirecting a legacy path', '/profile/keys/1', '/-/profile/keys/1' it "to #destroy" do expect(delete("/-/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1') @@ -198,7 +194,6 @@ RSpec.describe Profiles::GpgKeysController, "routing" do it "to #index" do expect(get("/-/profile/gpg_keys")).to route_to('profiles/gpg_keys#index') end - it_behaves_like 'redirecting a legacy path', '/profile/gpg_keys', '/-/profile/gpg_keys' it "to #create" do expect(post("/-/profile/gpg_keys")).to route_to('profiles/gpg_keys#create') @@ -216,7 +211,6 @@ RSpec.describe Profiles::EmailsController, "routing" do it "to #index" do expect(get("/-/profile/emails")).to route_to('profiles/emails#index') end - it_behaves_like 'redirecting a legacy path', '/profile/emails', '/-/profile/emails' it "to #create" do expect(post("/-/profile/emails")).to route_to('profiles/emails#create') @@ -335,10 +329,6 @@ RSpec.describe InvitesController, 'routing' do it 'to #show' do expect(get("/-/invites/#{member.invite_token}")).to route_to('invites#show', id: member.invite_token) end - - it 'to legacy route' do - expect(get("/invites/#{member.invite_token}")).to route_to('invites#show', id: member.invite_token) - end end RSpec.describe AbuseReportsController, 'routing' do @@ -347,10 +337,6 @@ RSpec.describe AbuseReportsController, 'routing' do it 'to #new' do expect(get("/-/abuse_reports/new?user_id=#{user.id}")).to route_to('abuse_reports#new', user_id: user.id.to_s) end - - it 'to legacy route' do - expect(get("/abuse_reports/new?user_id=#{user.id}")).to route_to('abuse_reports#new', user_id: user.id.to_s) - end end RSpec.describe SentNotificationsController, 'routing' do @@ -376,12 +362,6 @@ RSpec.describe AutocompleteController, 'routing' do it 'to #merge_request_target_branches' do expect(get("/-/autocomplete/merge_request_target_branches")).to route_to('autocomplete#merge_request_target_branches') end - - it 'to legacy route' do - expect(get("/autocomplete/users")).to route_to('autocomplete#users') - expect(get("/autocomplete/projects")).to route_to('autocomplete#projects') - expect(get("/autocomplete/award_emojis")).to route_to('autocomplete#award_emojis') - end end RSpec.describe Snippets::BlobsController, "routing" do |