Commit efdae23c authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch 'dblessing_redirect_deprecated_profile_paths' into 'master'

Redirect deprecated profile paths to scoped path

See merge request gitlab-org/gitlab!51646
parents fa0a8ce5 56cb598e
---
title: Redirect deprecated profile paths to scoped path
merge_request: 51646
author:
type: changed
...@@ -279,7 +279,8 @@ Rails.application.routes.draw do ...@@ -279,7 +279,8 @@ Rails.application.routes.draw do
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/210024 # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/210024
scope as: 'deprecated' do scope as: 'deprecated' do
draw :snippets draw :snippets
draw :profile
Gitlab::Routing.redirect_legacy_paths(self, :profile)
end end
Gitlab.ee do Gitlab.ee do
......
...@@ -43,7 +43,7 @@ RSpec.describe "Dashboard access" do ...@@ -43,7 +43,7 @@ RSpec.describe "Dashboard access" do
it { expect(new_group_path).to be_allowed_for :auditor } it { expect(new_group_path).to be_allowed_for :auditor }
end end
describe "GET /profile/groups" do describe "GET /dashboard/groups" do
subject { dashboard_groups_path } subject { dashboard_groups_path }
it { is_expected.to be_allowed_for :auditor } it { is_expected.to be_allowed_for :auditor }
......
...@@ -5,37 +5,37 @@ require 'spec_helper' ...@@ -5,37 +5,37 @@ require 'spec_helper'
RSpec.describe "Profile access" do RSpec.describe "Profile access" do
include AccessMatchers include AccessMatchers
describe "GET /profile/keys" do describe "GET /-/profile/keys" do
subject { profile_keys_path } subject { profile_keys_path }
it { is_expected.to be_allowed_for :auditor } it { is_expected.to be_allowed_for :auditor }
end end
describe "GET /profile" do describe "GET /-/profile" do
subject { profile_path } subject { profile_path }
it { is_expected.to be_allowed_for :auditor } it { is_expected.to be_allowed_for :auditor }
end end
describe "GET /profile/account" do describe "GET /-/profile/account" do
subject { profile_account_path } subject { profile_account_path }
it { is_expected.to be_allowed_for :auditor } it { is_expected.to be_allowed_for :auditor }
end end
describe "GET /profile/preferences" do describe "GET /-/profile/preferences" do
subject { profile_preferences_path } subject { profile_preferences_path }
it { is_expected.to be_allowed_for :auditor } it { is_expected.to be_allowed_for :auditor }
end end
describe "GET /profile/audit_log" do describe "GET /-/profile/audit_log" do
subject { audit_log_profile_path } subject { audit_log_profile_path }
it { is_expected.to be_allowed_for :auditor } it { is_expected.to be_allowed_for :auditor }
end end
describe "GET /profile/notifications" do describe "GET /-/profile/notifications" do
subject { profile_notifications_path } subject { profile_notifications_path }
it { is_expected.to be_allowed_for :auditor } it { is_expected.to be_allowed_for :auditor }
......
...@@ -30,7 +30,7 @@ RSpec.describe 'EE-specific project routing' do ...@@ -30,7 +30,7 @@ RSpec.describe 'EE-specific project routing' do
end end
describe 'legacy routing' do describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/vulnerability_feedback", "/gitlab/gitlabhq/-/vulnerability_feedback" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/vulnerability_feedback", "/gitlab/gitlabhq/-/vulnerability_feedback"
end end
end end
...@@ -49,13 +49,13 @@ RSpec.describe 'EE-specific project routing' do ...@@ -49,13 +49,13 @@ RSpec.describe 'EE-specific project routing' do
describe Projects::ProtectedEnvironmentsController, 'routing' do describe Projects::ProtectedEnvironmentsController, 'routing' do
describe 'legacy routing' do describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/protected_environments", "/gitlab/gitlabhq/-/protected_environments" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/protected_environments", "/gitlab/gitlabhq/-/protected_environments"
end end
end end
describe Projects::AuditEventsController, 'routing' do describe Projects::AuditEventsController, 'routing' do
describe 'legacy routing' do describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/audit_events", "/gitlab/gitlabhq/-/audit_events" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/audit_events", "/gitlab/gitlabhq/-/audit_events"
end end
end end
......
...@@ -57,7 +57,7 @@ RSpec.describe "Dashboard access" do ...@@ -57,7 +57,7 @@ RSpec.describe "Dashboard access" do
it { expect(new_group_path).to be_denied_for :visitor } it { expect(new_group_path).to be_denied_for :visitor }
end end
describe "GET /profile/groups" do describe "GET /dashboard/groups" do
subject { dashboard_groups_path } subject { dashboard_groups_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe "Profile access" do RSpec.describe "Profile access" do
include AccessMatchers include AccessMatchers
describe "GET /profile/keys" do describe "GET /-/profile/keys" do
subject { profile_keys_path } subject { profile_keys_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
...@@ -13,7 +13,7 @@ RSpec.describe "Profile access" do ...@@ -13,7 +13,7 @@ RSpec.describe "Profile access" do
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile" do describe "GET /-/profile" do
subject { profile_path } subject { profile_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
...@@ -21,7 +21,7 @@ RSpec.describe "Profile access" do ...@@ -21,7 +21,7 @@ RSpec.describe "Profile access" do
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/account" do describe "GET /-/profile/account" do
subject { profile_account_path } subject { profile_account_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
...@@ -29,7 +29,7 @@ RSpec.describe "Profile access" do ...@@ -29,7 +29,7 @@ RSpec.describe "Profile access" do
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/preferences" do describe "GET /-/profile/preferences" do
subject { profile_preferences_path } subject { profile_preferences_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
...@@ -37,7 +37,7 @@ RSpec.describe "Profile access" do ...@@ -37,7 +37,7 @@ RSpec.describe "Profile access" do
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/audit_log" do describe "GET /-/profile/audit_log" do
subject { audit_log_profile_path } subject { audit_log_profile_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
...@@ -45,7 +45,7 @@ RSpec.describe "Profile access" do ...@@ -45,7 +45,7 @@ RSpec.describe "Profile access" do
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/notifications" do describe "GET /-/profile/notifications" do
subject { profile_notifications_path } subject { profile_notifications_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
......
...@@ -102,6 +102,7 @@ RSpec.describe Gitlab::PathRegex do ...@@ -102,6 +102,7 @@ RSpec.describe Gitlab::PathRegex do
.concat(files_in_public) .concat(files_in_public)
.concat(Array(API::API.prefix.to_s)) .concat(Array(API::API.prefix.to_s))
.concat(sitemap_words) .concat(sitemap_words)
.concat(deprecated_routes)
.compact .compact
.uniq .uniq
end end
...@@ -110,6 +111,11 @@ RSpec.describe Gitlab::PathRegex do ...@@ -110,6 +111,11 @@ RSpec.describe Gitlab::PathRegex do
%w(sitemap sitemap.xml sitemap.xml.gz) %w(sitemap sitemap.xml sitemap.xml.gz)
end end
let(:deprecated_routes) do
# profile was deprecated in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51646
%w(profile)
end
let(:ee_top_level_words) do let(:ee_top_level_words) do
%w(unsubscribes v2) %w(unsubscribes v2)
end end
......
...@@ -24,7 +24,7 @@ RSpec.describe 'view user notifications' do ...@@ -24,7 +24,7 @@ RSpec.describe 'view user notifications' do
get profile_notifications_path get profile_notifications_path
end end
describe 'GET /profile/notifications' do describe 'GET /-/profile/notifications' do
it 'does not have an N+1 due to an additional groups (with no parent group)' do it 'does not have an N+1 due to an additional groups (with no parent group)' do
get_profile_notifications get_profile_notifications
......
...@@ -4,15 +4,15 @@ require "spec_helper" ...@@ -4,15 +4,15 @@ require "spec_helper"
RSpec.describe "notifications routing" do RSpec.describe "notifications routing" do
it "routes to #show" do it "routes to #show" do
expect(get("/profile/notifications")).to route_to("profiles/notifications#show") expect(get("/-/profile/notifications")).to route_to("profiles/notifications#show")
end end
it "routes to #update" do it "routes to #update" do
expect(put("/profile/notifications")).to route_to("profiles/notifications#update") expect(put("/-/profile/notifications")).to route_to("profiles/notifications#update")
end end
it 'routes to group #update' do it 'routes to group #update' do
expect(put("/profile/notifications/groups/gitlab-org")).to route_to("profiles/groups#update", id: 'gitlab-org') expect(put("/-/profile/notifications/groups/gitlab-org")).to route_to("profiles/groups#update", id: 'gitlab-org')
expect(put("/profile/notifications/groups/gitlab.org")).to route_to("profiles/groups#update", id: 'gitlab.org') expect(put("/-/profile/notifications/groups/gitlab.org")).to route_to("profiles/groups#update", id: 'gitlab.org')
end end
end end
...@@ -106,8 +106,8 @@ RSpec.describe 'project routing' do ...@@ -106,8 +106,8 @@ RSpec.describe 'project routing' do
let(:base_path) { '/gitlab/gitlabhq/-/wikis' } let(:base_path) { '/gitlab/gitlabhq/-/wikis' }
end end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/wikis", "/gitlab/gitlabhq/-/wikis" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/wikis", "/gitlab/gitlabhq/-/wikis"
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/wikis/home/edit", "/gitlab/gitlabhq/-/wikis/home/edit" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/wikis/home/edit", "/gitlab/gitlabhq/-/wikis/home/edit"
end end
# branches_project_repository GET /:project_id/repository/branches(.:format) projects/repositories#branches # branches_project_repository GET /:project_id/repository/branches(.:format) projects/repositories#branches
...@@ -171,7 +171,7 @@ RSpec.describe 'project routing' do ...@@ -171,7 +171,7 @@ RSpec.describe 'project routing' do
expect(delete('/gitlab/gitlabhq/-/tags/feature@45/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45/foo/bar/baz') expect(delete('/gitlab/gitlabhq/-/tags/feature@45/foo/bar/baz')).to route_to('projects/tags#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45/foo/bar/baz')
end end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/tags", "/gitlab/gitlabhq/-/tags" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/tags", "/gitlab/gitlabhq/-/tags"
end end
# project_deploy_keys GET /:project_id/deploy_keys(.:format) deploy_keys#index # project_deploy_keys GET /:project_id/deploy_keys(.:format) deploy_keys#index
...@@ -259,8 +259,8 @@ RSpec.describe 'project routing' do ...@@ -259,8 +259,8 @@ RSpec.describe 'project routing' do
let(:base_path) { '/gitlab/gitlabhq/-/merge_requests' } let(:base_path) { '/gitlab/gitlabhq/-/merge_requests' }
end end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/merge_requests", "/gitlab/gitlabhq/-/merge_requests" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/merge_requests", "/gitlab/gitlabhq/-/merge_requests"
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/merge_requests/1/diffs", "/gitlab/gitlabhq/-/merge_requests/1/diffs" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/merge_requests/1/diffs", "/gitlab/gitlabhq/-/merge_requests/1/diffs"
end end
describe Projects::MergeRequests::CreationsController, 'routing' do describe Projects::MergeRequests::CreationsController, 'routing' do
...@@ -290,7 +290,7 @@ RSpec.describe 'project routing' do ...@@ -290,7 +290,7 @@ RSpec.describe 'project routing' do
expect(get('/gitlab/gitlabhq/-/merge_requests/new/diffs.json')).to route_to('projects/merge_requests/creations#diffs', namespace_id: 'gitlab', project_id: 'gitlabhq', format: 'json') expect(get('/gitlab/gitlabhq/-/merge_requests/new/diffs.json')).to route_to('projects/merge_requests/creations#diffs', namespace_id: 'gitlab', project_id: 'gitlabhq', format: 'json')
end end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/merge_requests/new", "/gitlab/gitlabhq/-/merge_requests/new" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/merge_requests/new", "/gitlab/gitlabhq/-/merge_requests/new"
end end
describe Projects::MergeRequests::DiffsController, 'routing' do describe Projects::MergeRequests::DiffsController, 'routing' do
...@@ -454,8 +454,8 @@ RSpec.describe 'project routing' do ...@@ -454,8 +454,8 @@ RSpec.describe 'project routing' do
let(:base_path) { '/gitlab/gitlabhq/-/issues' } let(:base_path) { '/gitlab/gitlabhq/-/issues' }
end end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/issues", "/gitlab/gitlabhq/-/issues" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/issues", "/gitlab/gitlabhq/-/issues"
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/issues/1/edit", "/gitlab/gitlabhq/-/issues/1/edit" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/issues/1/edit", "/gitlab/gitlabhq/-/issues/1/edit"
end end
# project_noteable_notes GET /:project_id/noteable/:target_type/:target_id/notes notes#index # project_noteable_notes GET /:project_id/noteable/:target_type/:target_id/notes notes#index
...@@ -769,25 +769,25 @@ RSpec.describe 'project routing' do ...@@ -769,25 +769,25 @@ RSpec.describe 'project routing' do
describe Projects::EnvironmentsController, 'routing' do describe Projects::EnvironmentsController, 'routing' do
describe 'legacy routing' do describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/environments", "/gitlab/gitlabhq/-/environments" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/environments", "/gitlab/gitlabhq/-/environments"
end end
end end
describe Projects::ClustersController, 'routing' do describe Projects::ClustersController, 'routing' do
describe 'legacy routing' do describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/clusters", "/gitlab/gitlabhq/-/clusters" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/clusters", "/gitlab/gitlabhq/-/clusters"
end end
end end
describe Projects::ErrorTrackingController, 'routing' do describe Projects::ErrorTrackingController, 'routing' do
describe 'legacy routing' do describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/error_tracking", "/gitlab/gitlabhq/-/error_tracking" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/error_tracking", "/gitlab/gitlabhq/-/error_tracking"
end end
end end
describe Projects::Serverless, 'routing' do describe Projects::Serverless, 'routing' do
describe 'legacy routing' do describe 'legacy routing' do
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/serverless", "/gitlab/gitlabhq/-/serverless" it_behaves_like 'redirecting a legacy path', "/gitlab/gitlabhq/serverless", "/gitlab/gitlabhq/-/serverless"
end end
end end
......
...@@ -122,111 +122,115 @@ RSpec.describe HelpController, "routing" do ...@@ -122,111 +122,115 @@ RSpec.describe HelpController, "routing" do
end end
end end
# profile_account GET /profile/account(.:format) profile#account # profile_account GET /-/profile/account(.:format) profile#account
# profile_history GET /profile/history(.:format) profile#history # profile_history GET /-/profile/history(.:format) profile#history
# profile_password PUT /profile/password(.:format) profile#password_update # profile_password PUT /-/profile/password(.:format) profile#password_update
# profile_token GET /profile/token(.:format) profile#token # profile_token GET /-/profile/token(.:format) profile#token
# profile GET /profile(.:format) profile#show # profile GET /-/profile(.:format) profile#show
# profile_update PUT /profile/update(.:format) profile#update # profile_update PUT /-/profile/update(.:format) profile#update
RSpec.describe ProfilesController, "routing" do RSpec.describe ProfilesController, "routing" do
it "to #account" do it "to #account" do
expect(get("/profile/account")).to route_to('profiles/accounts#show') expect(get("/-/profile/account")).to route_to('profiles/accounts#show')
end end
it_behaves_like 'redirecting a legacy path', '/profile/account', '/-/profile/account'
it "to #audit_log" do it "to #audit_log" do
expect(get("/profile/audit_log")).to route_to('profiles#audit_log') expect(get("/-/profile/audit_log")).to route_to('profiles#audit_log')
end end
it_behaves_like 'redirecting a legacy path', '/profile/audit_log', '/-/profile/audit_log'
it "to #reset_feed_token" do it "to #reset_feed_token" do
expect(put("/profile/reset_feed_token")).to route_to('profiles#reset_feed_token') expect(put("/-/profile/reset_feed_token")).to route_to('profiles#reset_feed_token')
end end
it "to #show" do it "to #show" do
expect(get("/profile")).to route_to('profiles#show')
end
it 'to #show from scope routing' do
expect(get("/-/profile")).to route_to('profiles#show') expect(get("/-/profile")).to route_to('profiles#show')
end end
it_behaves_like 'redirecting a legacy path', '/profile', '/-/profile'
end end
# profile_preferences GET /profile/preferences(.:format) profiles/preferences#show # profile_preferences GET /-/profile/preferences(.:format) profiles/preferences#show
# PATCH /profile/preferences(.:format) profiles/preferences#update # PATCH /-/profile/preferences(.:format) profiles/preferences#update
# PUT /profile/preferences(.:format) profiles/preferences#update # PUT /-/profile/preferences(.:format) profiles/preferences#update
RSpec.describe Profiles::PreferencesController, 'routing' do RSpec.describe Profiles::PreferencesController, 'routing' do
it 'to #show' do it 'to #show' do
expect(get('/profile/preferences')).to route_to('profiles/preferences#show') expect(get('/-/profile/preferences')).to route_to('profiles/preferences#show')
end end
it_behaves_like 'redirecting a legacy path', '/profile/preferences', '/-/profile/preferences'
it 'to #update' do it 'to #update' do
expect(put('/profile/preferences')).to route_to('profiles/preferences#update') expect(put('/-/profile/preferences')).to route_to('profiles/preferences#update')
expect(patch('/profile/preferences')).to route_to('profiles/preferences#update') expect(patch('/-/profile/preferences')).to route_to('profiles/preferences#update')
end end
end end
# keys GET /keys(.:format) keys#index # keys GET /-/profile/keys(.:format) keys#index
# POST /keys(.:format) keys#create # POST /-/profile/keys(.:format) keys#create
# edit_key GET /keys/:id/edit(.:format) keys#edit # edit_key GET /-/profile/keys/:id/edit(.:format) keys#edit
# key GET /keys/:id(.:format) keys#show # key GET /-/profile/keys/:id(.:format) keys#show
# PUT /keys/:id(.:format) keys#update # PUT /-/profile/keys/:id(.:format) keys#update
# DELETE /keys/:id(.:format) keys#destroy # DELETE /-/profile/keys/:id(.:format) keys#destroy
RSpec.describe Profiles::KeysController, "routing" do RSpec.describe Profiles::KeysController, "routing" do
it "to #index" do it "to #index" do
expect(get("/profile/keys")).to route_to('profiles/keys#index') expect(get("/-/profile/keys")).to route_to('profiles/keys#index')
end end
it_behaves_like 'redirecting a legacy path', '/profile/keys', '/-/profile/keys'
it "to #create" do it "to #create" do
expect(post("/profile/keys")).to route_to('profiles/keys#create') expect(post("/-/profile/keys")).to route_to('profiles/keys#create')
end end
it "to #show" do it "to #show" do
expect(get("/profile/keys/1")).to route_to('profiles/keys#show', id: '1') expect(get("/-/profile/keys/1")).to route_to('profiles/keys#show', id: '1')
end end
it_behaves_like 'redirecting a legacy path', '/profile/keys/1', '/-/profile/keys/1'
it "to #destroy" do it "to #destroy" do
expect(delete("/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1') expect(delete("/-/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1')
end end
end end
# keys GET /gpg_keys gpg_keys#index # keys GET /-/profile/gpg_keys gpg_keys#index
# key POST /gpg_keys gpg_keys#create # key POST /-/profile/gpg_keys gpg_keys#create
# PUT /gpg_keys/:id gpg_keys#revoke # PUT /-/profile/gpg_keys/:id gpg_keys#revoke
# DELETE /gpg_keys/:id gpg_keys#desroy # DELETE /-/profile/gpg_keys/:id gpg_keys#desroy
RSpec.describe Profiles::GpgKeysController, "routing" do RSpec.describe Profiles::GpgKeysController, "routing" do
it "to #index" do it "to #index" do
expect(get("/profile/gpg_keys")).to route_to('profiles/gpg_keys#index') expect(get("/-/profile/gpg_keys")).to route_to('profiles/gpg_keys#index')
end end
it_behaves_like 'redirecting a legacy path', '/profile/gpg_keys', '/-/profile/gpg_keys'
it "to #create" do it "to #create" do
expect(post("/profile/gpg_keys")).to route_to('profiles/gpg_keys#create') expect(post("/-/profile/gpg_keys")).to route_to('profiles/gpg_keys#create')
end end
it "to #destroy" do it "to #destroy" do
expect(delete("/profile/gpg_keys/1")).to route_to('profiles/gpg_keys#destroy', id: '1') expect(delete("/-/profile/gpg_keys/1")).to route_to('profiles/gpg_keys#destroy', id: '1')
end end
end end
# emails GET /emails(.:format) emails#index # emails GET /-/profile/emails(.:format) emails#index
# POST /keys(.:format) emails#create # POST /-/profile/emails(.:format) emails#create
# DELETE /keys/:id(.:format) keys#destroy # DELETE /-/profile/emails/:id(.:format) keys#destroy
RSpec.describe Profiles::EmailsController, "routing" do RSpec.describe Profiles::EmailsController, "routing" do
it "to #index" do it "to #index" do
expect(get("/profile/emails")).to route_to('profiles/emails#index') expect(get("/-/profile/emails")).to route_to('profiles/emails#index')
end end
it_behaves_like 'redirecting a legacy path', '/profile/emails', '/-/profile/emails'
it "to #create" do it "to #create" do
expect(post("/profile/emails")).to route_to('profiles/emails#create') expect(post("/-/profile/emails")).to route_to('profiles/emails#create')
end end
it "to #destroy" do it "to #destroy" do
expect(delete("/profile/emails/1")).to route_to('profiles/emails#destroy', id: '1') expect(delete("/-/profile/emails/1")).to route_to('profiles/emails#destroy', id: '1')
end end
end end
# profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy # profile_avatar DELETE /-/profile/avatar(.:format) profiles/avatars#destroy
RSpec.describe Profiles::AvatarsController, "routing" do RSpec.describe Profiles::AvatarsController, "routing" do
it "to #destroy" do it "to #destroy" do
expect(delete("/profile/avatar")).to route_to('profiles/avatars#destroy') expect(delete("/-/profile/avatar")).to route_to('profiles/avatars#destroy')
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'redirecting a legacy project path' do |source, target| RSpec.shared_examples 'redirecting a legacy path' do |source, target|
include RSpec::Rails::RequestExampleGroup include RSpec::Rails::RequestExampleGroup
it "redirects #{source} to #{target}" do it "redirects #{source} to #{target}" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment