]> git.openstreetmap.org Git - rails.git/blob - test/integration/redirect_test.rb
Merge remote-tracking branch 'upstream/pull/5424'
[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_redirected_to "/"
7
8     get "/create-account.html"
9     assert_redirected_to "/user/new"
10
11     get "/forgot-password.html"
12     assert_redirected_to "/user/forgot-password"
13   end
14
15   def test_search_redirects
16     get "/?query=test"
17     assert_redirected_to "/search?query=test"
18   end
19
20   def test_history_redirects
21     get "/browse"
22     assert_redirected_to "/history"
23
24     get "/browse/changesets"
25     assert_redirected_to "/history"
26
27     get "/browse/changesets?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
28     assert_redirected_to "/history?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
29
30     get "/browse/friends"
31     assert_redirected_to "/history/friends"
32
33     get "/browse/nearby"
34     assert_redirected_to "/history/nearby"
35
36     get "/user/name/edits"
37     assert_redirected_to "/user/name/history"
38
39     get "/user/name%20with%20spaces/edits"
40     assert_redirected_to "/user/name%20with%20spaces/history"
41   end
42
43   def test_history_feed_redirects
44     get "/browse/changesets/feed"
45     assert_redirected_to "/history/feed"
46
47     get "/browse/changesets/feed?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
48     assert_redirected_to "/history/feed?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
49
50     get "/user/name/edits/feed"
51     assert_redirected_to "/user/name/history/feed"
52
53     get "/user/name%20with%20spaces/edits/feed"
54     assert_redirected_to "/user/name%20with%20spaces/history/feed"
55   end
56
57   def test_browse_redirects
58     get "/browse/node/1"
59     assert_redirected_to "/node/1"
60
61     get "/browse/way/1"
62     assert_redirected_to "/way/1"
63
64     get "/browse/relation/1"
65     assert_redirected_to "/relation/1"
66
67     get "/browse/changeset/1"
68     assert_redirected_to "/changeset/1"
69
70     get "/browse/note/1"
71     assert_redirected_to "/note/1"
72   end
73
74   def test_browse_history_redirects
75     get "/browse/node/1/history"
76     assert_redirected_to "/node/1/history"
77
78     get "/browse/way/1/history"
79     assert_redirected_to "/way/1/history"
80
81     get "/browse/relation/1/history"
82     assert_redirected_to "/relation/1/history"
83   end
84 end