Replace some legacy routes with redirects

This commit is contained in:
Tom Hughes 2013-12-03 19:08:21 +00:00
parent ba4a3e3ce9
commit e418075e26
4 changed files with 17 additions and 15 deletions

View file

@ -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_@~]+[=-]*/

View file

@ -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" }

View file

@ -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" }

View file

@ -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