Ticket #8546: dont_escape_redirect_urls.diff
| File dont_escape_redirect_urls.diff, 2.5 kB (added by josh, 2 years ago) |
|---|
-
actionpack/test/controller/redirect_test.rb
old new 37 37 redirect_to :action => "hello_world" 38 38 end 39 39 40 def redirect_to_url 41 redirect_to "http://www.rubyonrails.org/" 42 end 43 44 def redirect_to_url_with_unescaped_query_string 45 redirect_to "http://dev.rubyonrails.org/query?status=new" 46 end 47 40 48 def redirect_to_back 41 49 redirect_to :back 42 50 end … … 111 119 assert_equal "world", assigns["hello"] 112 120 end 113 121 122 def test_redirect_to_url 123 get :redirect_to_url 124 assert_response :redirect 125 assert_redirected_to "http://www.rubyonrails.org/" 126 end 127 128 def test_redirect_to_url_with_unescaped_query_string 129 get :redirect_to_url_with_unescaped_query_string 130 assert_response :redirect 131 assert_redirected_to "http://dev.rubyonrails.org/query?status=new" 132 end 133 114 134 def test_redirect_to_back 115 135 @request.env["HTTP_REFERER"] = "http://www.example.com/coming/from" 116 136 get :redirect_to_back -
actionpack/test/template/prototype_helper_test.rb
old new 314 314 def test_redirect_to 315 315 assert_equal 'window.location.href = "http://www.example.com/welcome";', 316 316 @generator.redirect_to(:action => 'welcome') 317 assert_equal 'window.location.href = "http://www.example.com/welcome?a=b&c=d";', 318 @generator.redirect_to("http://www.example.com/welcome?a=b&c=d") 317 319 end 318 320 319 321 def test_delay -
actionpack/lib/action_view/helpers/prototype_helper.rb
old new 554 554 555 555 # Redirects the browser to the given +location+, in the same form as +url_for+. 556 556 def redirect_to(location) 557 assign 'window.location.href', @context.url_for(location) 557 url = location.is_a?(String) ? location : @context.url_for(location) 558 assign 'window.location.href', url 558 559 end 559 560 560 561 # Calls the JavaScript +function+, optionally with the given +arguments+.