Standardise on double quoted strings
[rails.git] / test / integration / redirect_test.rb
1 require "test_helper"
2
3 class RedirectTest  < ActionDispatch::IntegrationTest
4   def test_legacy_redirects
5     get "/index.html"
6     assert_response :redirect
7     assert_redirected_to "/"
8
9     get "/create-account.html"
10     assert_response :redirect
11     assert_redirected_to "/user/new"
12
13     get "/forgot-password.html"
14     assert_response :redirect
15     assert_redirected_to "/user/forgot-password"
16   end
17
18   def test_search_redirects
19     get "/?query=test"
20     assert_response :redirect
21     assert_redirected_to "/search?query=test"
22   end
23
24   def test_history_redirects
25     get "/browse"
26     assert_response :redirect
27     assert_redirected_to "/history"
28
29     get "/browse/changesets"
30     assert_response :redirect
31     assert_redirected_to "/history"
32
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"
36
37     get "/browse/friends"
38     assert_response :redirect
39     assert_redirected_to "/history/friends"
40
41     get "/browse/nearby"
42     assert_response :redirect
43     assert_redirected_to "/history/nearby"
44
45     get "/user/name/edits"
46     assert_response :redirect
47     assert_redirected_to "/user/name/history"
48
49     get "/user/name%20with%20spaces/edits"
50     assert_response :redirect
51     assert_redirected_to "/user/name%20with%20spaces/history"
52   end
53
54   def test_history_feed_redirects
55     get "/browse/changesets/feed"
56     assert_response :redirect
57     assert_redirected_to "/history/feed"
58
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"
62
63     get "/user/name/edits/feed"
64     assert_response :redirect
65     assert_redirected_to "/user/name/history/feed"
66
67     get "/user/name%20with%20spaces/edits/feed"
68     assert_response :redirect
69     assert_redirected_to "/user/name%20with%20spaces/history/feed"
70   end
71
72   def test_browse_redirects
73     get "/browse/node/1"
74     assert_response :redirect
75     assert_redirected_to "/node/1"
76
77     get "/browse/way/1"
78     assert_response :redirect
79     assert_redirected_to "/way/1"
80
81     get "/browse/relation/1"
82     assert_response :redirect
83     assert_redirected_to "/relation/1"
84
85     get "/browse/changeset/1"
86     assert_response :redirect
87     assert_redirected_to "/changeset/1"
88
89     get "/browse/note/1"
90     assert_response :redirect
91     assert_redirected_to "/note/1"
92   end
93
94   def test_browse_history_redirects
95     get "/browse/node/1/history"
96     assert_response :redirect
97     assert_redirected_to "/node/1/history"
98
99     get "/browse/way/1/history"
100     assert_response :redirect
101     assert_redirected_to "/way/1/history"
102
103     get "/browse/relation/1/history"
104     assert_response :redirect
105     assert_redirected_to "/relation/1/history"
106   end
107 end