Preserve the bounding box when redirecting history URLs
[rails.git] / test / integration / redirect_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class RedirectTest  < ActionDispatch::IntegrationTest
4   def test_search_redirects
5     get "/?query=test"
6     assert_response :redirect
7     assert_redirected_to "/search?query=test"
8   end
9
10   def test_history_redirects
11     get "/browse"
12     assert_response :redirect
13     assert_redirected_to "/history"
14
15     get "/browse/changesets"
16     assert_response :redirect
17     assert_redirected_to "/history"
18
19     get "/browse/changesets?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
20     assert_response :redirect
21     assert_redirected_to "/history?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
22
23     get "/browse/friends"
24     assert_response :redirect
25     assert_redirected_to "/history/friends"
26
27     get "/browse/nearby"
28     assert_response :redirect
29     assert_redirected_to "/history/nearby"
30
31     get "/user/name/edits"
32     assert_response :redirect
33     assert_redirected_to "/user/name/history"
34   end
35
36   def test_history_feed_redirects
37     get "/browse/changesets/feed"
38     assert_response :redirect
39     assert_redirected_to "/history/feed"
40
41     get "/browse/changesets/feed?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
42     assert_response :redirect
43     assert_redirected_to "/history/feed?bbox=-80.54%2C40.358%2C-79.526%2C40.779"
44
45     get "/user/name/edits/feed"
46     assert_response :redirect
47     assert_redirected_to "/user/name/history/feed"
48   end
49
50   def test_browse_redirects
51     get "/browse/node/1"
52     assert_response :redirect
53     assert_redirected_to "/node/1"
54
55     get "/browse/way/1"
56     assert_response :redirect
57     assert_redirected_to "/way/1"
58
59     get "/browse/relation/1"
60     assert_response :redirect
61     assert_redirected_to "/relation/1"
62
63     get "/browse/changeset/1"
64     assert_response :redirect
65     assert_redirected_to "/changeset/1"
66
67     get "/browse/note/1"
68     assert_response :redirect
69     assert_redirected_to "/note/1"
70   end
71
72   def test_browse_history_redirects
73     get "/browse/node/1/history"
74     assert_response :redirect
75     assert_redirected_to "/node/1/history"
76
77     get "/browse/way/1/history"
78     assert_response :redirect
79     assert_redirected_to "/way/1/history"
80
81     get "/browse/relation/1/history"
82     assert_response :redirect
83     assert_redirected_to "/relation/1/history"
84   end
85 end