From: Tom Hughes Date: Tue, 3 Dec 2013 19:08:21 +0000 (+0000) Subject: Replace some legacy routes with redirects X-Git-Tag: live~4598 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/e418075e26d80d68e4127d3358a2d8b11dee3a13?hp=ba4a3e3ce96eddc9bbbcde1f255a80f65f49dc8f Replace some legacy routes with redirects --- diff --git a/config/routes.rb b/config/routes.rb index d110472bf..500a9b13c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -162,9 +162,9 @@ OpenStreetMap::Application.routes.draw do match '/user/forgot-password' => 'user#lost_password', :via => [:get, :post] match '/user/suspended' => 'user#suspended', :via => :get - match '/index.html' => 'site#index', :via => :get - match '/create-account.html' => 'user#new', :via => :get - match '/forgot-password.html' => 'user#lost_password', :via => :get + get '/index.html', :to => redirect(:path => "/") + get '/create-account.html', :to => redirect(:path => "/user/new") + get '/forgot-password.html', :to => redirect(:path => "/user/forgot-password") # permalink match '/go/:code' => 'site#permalink', :via => :get, :code => /[a-zA-Z0-9_@~]+[=-]*/ diff --git a/test/functional/site_controller_test.rb b/test/functional/site_controller_test.rb index 86a8fe609..d55761f82 100644 --- a/test/functional/site_controller_test.rb +++ b/test/functional/site_controller_test.rb @@ -14,10 +14,6 @@ class SiteControllerTest < ActionController::TestCase { :path => "/", :method => :post }, { :controller => "site", :action => "index" } ) - assert_recognizes( - { :controller => "site", :action => "index" }, - { :path => "/index.html", :method => :get } - ) assert_routing( { :path => "/edit", :method => :get }, { :controller => "site", :action => "edit" } diff --git a/test/functional/user_controller_test.rb b/test/functional/user_controller_test.rb index 873beccad..d4121c1bd 100644 --- a/test/functional/user_controller_test.rb +++ b/test/functional/user_controller_test.rb @@ -49,10 +49,6 @@ class UserControllerTest < ActionController::TestCase { :path => "/user/new", :method => :get }, { :controller => "user", :action => "new" } ) - assert_recognizes( - { :controller => "user", :action => "new" }, - { :path => "/create-account.html", :method => :get } - ) assert_routing( { :path => "/user/new", :method => :post }, @@ -112,10 +108,6 @@ class UserControllerTest < ActionController::TestCase { :path => "/user/forgot-password", :method => :post }, { :controller => "user", :action => "lost_password" } ) - assert_recognizes( - { :controller => "user", :action => "lost_password" }, - { :path => "/forgot-password.html", :method => :get } - ) assert_routing( { :path => "/user/reset-password", :method => :get }, { :controller => "user", :action => "reset_password" } diff --git a/test/integration/redirect_test.rb b/test/integration/redirect_test.rb index 1c4af7d4f..357c20212 100644 --- a/test/integration/redirect_test.rb +++ b/test/integration/redirect_test.rb @@ -1,6 +1,20 @@ require File.dirname(__FILE__) + '/../test_helper' class RedirectTest < ActionDispatch::IntegrationTest + def test_legacy_redirects + get "/index.html" + assert_response :redirect + assert_redirected_to "/" + + get "/create-account.html" + assert_response :redirect + assert_redirected_to "/user/new" + + get "/forgot-password.html" + assert_response :redirect + assert_redirected_to "/user/forgot-password" + end + def test_search_redirects get "/?query=test" assert_response :redirect