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_@~]+[=-]*/
{ :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" }
{ :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 },
{ :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" }
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