Replace some legacy routes with redirects
This commit is contained in:
parent
ba4a3e3ce9
commit
e418075e26
4 changed files with 17 additions and 15 deletions
|
@ -162,9 +162,9 @@ OpenStreetMap::Application.routes.draw do
|
||||||
match '/user/forgot-password' => 'user#lost_password', :via => [:get, :post]
|
match '/user/forgot-password' => 'user#lost_password', :via => [:get, :post]
|
||||||
match '/user/suspended' => 'user#suspended', :via => :get
|
match '/user/suspended' => 'user#suspended', :via => :get
|
||||||
|
|
||||||
match '/index.html' => 'site#index', :via => :get
|
get '/index.html', :to => redirect(:path => "/")
|
||||||
match '/create-account.html' => 'user#new', :via => :get
|
get '/create-account.html', :to => redirect(:path => "/user/new")
|
||||||
match '/forgot-password.html' => 'user#lost_password', :via => :get
|
get '/forgot-password.html', :to => redirect(:path => "/user/forgot-password")
|
||||||
|
|
||||||
# permalink
|
# permalink
|
||||||
match '/go/:code' => 'site#permalink', :via => :get, :code => /[a-zA-Z0-9_@~]+[=-]*/
|
match '/go/:code' => 'site#permalink', :via => :get, :code => /[a-zA-Z0-9_@~]+[=-]*/
|
||||||
|
|
|
@ -14,10 +14,6 @@ class SiteControllerTest < ActionController::TestCase
|
||||||
{ :path => "/", :method => :post },
|
{ :path => "/", :method => :post },
|
||||||
{ :controller => "site", :action => "index" }
|
{ :controller => "site", :action => "index" }
|
||||||
)
|
)
|
||||||
assert_recognizes(
|
|
||||||
{ :controller => "site", :action => "index" },
|
|
||||||
{ :path => "/index.html", :method => :get }
|
|
||||||
)
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/edit", :method => :get },
|
{ :path => "/edit", :method => :get },
|
||||||
{ :controller => "site", :action => "edit" }
|
{ :controller => "site", :action => "edit" }
|
||||||
|
|
|
@ -49,10 +49,6 @@ class UserControllerTest < ActionController::TestCase
|
||||||
{ :path => "/user/new", :method => :get },
|
{ :path => "/user/new", :method => :get },
|
||||||
{ :controller => "user", :action => "new" }
|
{ :controller => "user", :action => "new" }
|
||||||
)
|
)
|
||||||
assert_recognizes(
|
|
||||||
{ :controller => "user", :action => "new" },
|
|
||||||
{ :path => "/create-account.html", :method => :get }
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/new", :method => :post },
|
{ :path => "/user/new", :method => :post },
|
||||||
|
@ -112,10 +108,6 @@ class UserControllerTest < ActionController::TestCase
|
||||||
{ :path => "/user/forgot-password", :method => :post },
|
{ :path => "/user/forgot-password", :method => :post },
|
||||||
{ :controller => "user", :action => "lost_password" }
|
{ :controller => "user", :action => "lost_password" }
|
||||||
)
|
)
|
||||||
assert_recognizes(
|
|
||||||
{ :controller => "user", :action => "lost_password" },
|
|
||||||
{ :path => "/forgot-password.html", :method => :get }
|
|
||||||
)
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/reset-password", :method => :get },
|
{ :path => "/user/reset-password", :method => :get },
|
||||||
{ :controller => "user", :action => "reset_password" }
|
{ :controller => "user", :action => "reset_password" }
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class RedirectTest < ActionDispatch::IntegrationTest
|
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
|
def test_search_redirects
|
||||||
get "/?query=test"
|
get "/?query=test"
|
||||||
assert_response :redirect
|
assert_response :redirect
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue