1 require File.dirname(__FILE__) + '/../test_helper'
3 class RedirectTest < ActionDispatch::IntegrationTest
4 def test_legacy_redirects
6 assert_response :redirect
7 assert_redirected_to "/"
9 get "/create-account.html"
10 assert_response :redirect
11 assert_redirected_to "/user/new"
13 get "/forgot-password.html"
14 assert_response :redirect
15 assert_redirected_to "/user/forgot-password"
18 def test_search_redirects
20 assert_response :redirect
21 assert_redirected_to "/search?query=test"
24 def test_history_redirects
26 assert_response :redirect
27 assert_redirected_to "/history"
29 get "/browse/changesets"
30 assert_response :redirect
31 assert_redirected_to "/history"
33 get "/browse/changesets?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
34 assert_response :redirect
35 assert_redirected_to "/history?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
38 assert_response :redirect
39 assert_redirected_to "/history/friends"
42 assert_response :redirect
43 assert_redirected_to "/history/nearby"
45 get "/user/name/edits"
46 assert_response :redirect
47 assert_redirected_to "/user/name/history"
49 get "/user/name%20with%20spaces/edits"
50 assert_response :redirect
51 assert_redirected_to "/user/name%20with%20spaces/history"
54 def test_history_feed_redirects
55 get "/browse/changesets/feed"
56 assert_response :redirect
57 assert_redirected_to "/history/feed"
59 get "/browse/changesets/feed?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
60 assert_response :redirect
61 assert_redirected_to "/history/feed?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
63 get "/user/name/edits/feed"
64 assert_response :redirect
65 assert_redirected_to "/user/name/history/feed"
67 get "/user/name%20with%20spaces/edits/feed"
68 assert_response :redirect
69 assert_redirected_to "/user/name%20with%20spaces/history/feed"
72 def test_browse_redirects
74 assert_response :redirect
75 assert_redirected_to "/node/1"
78 assert_response :redirect
79 assert_redirected_to "/way/1"
81 get "/browse/relation/1"
82 assert_response :redirect
83 assert_redirected_to "/relation/1"
85 get "/browse/changeset/1"
86 assert_response :redirect
87 assert_redirected_to "/changeset/1"
90 assert_response :redirect
91 assert_redirected_to "/note/1"
94 def test_browse_history_redirects
95 get "/browse/node/1/history"
96 assert_response :redirect
97 assert_redirected_to "/node/1/history"
99 get "/browse/way/1/history"
100 assert_response :redirect
101 assert_redirected_to "/way/1/history"
103 get "/browse/relation/1/history"
104 assert_response :redirect
105 assert_redirected_to "/relation/1/history"