mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add test ensuring redirect_to uses the given protocol [#2886]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
parent
6464d76feb
commit
00544c778f
1 changed files with 10 additions and 0 deletions
|
@ -34,6 +34,10 @@ class RedirectController < ActionController::Base
|
||||||
redirect_to({:action => "hello_world"}, {:status => 301})
|
redirect_to({:action => "hello_world"}, {:status => 301})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def redirect_with_protocol
|
||||||
|
redirect_to :action => "hello_world", :protocol => "https"
|
||||||
|
end
|
||||||
|
|
||||||
def url_redirect_with_status
|
def url_redirect_with_status
|
||||||
redirect_to("http://www.example.com", :status => :moved_permanently)
|
redirect_to("http://www.example.com", :status => :moved_permanently)
|
||||||
end
|
end
|
||||||
|
@ -132,6 +136,12 @@ class RedirectTest < ActionController::TestCase
|
||||||
assert_equal "http://test.host/redirect/hello_world", redirect_to_url
|
assert_equal "http://test.host/redirect/hello_world", redirect_to_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_redirect_with_protocol
|
||||||
|
get :redirect_with_protocol
|
||||||
|
assert_response 302
|
||||||
|
assert_equal "https://test.host/redirect/hello_world", redirect_to_url
|
||||||
|
end
|
||||||
|
|
||||||
def test_url_redirect_with_status
|
def test_url_redirect_with_status
|
||||||
get :url_redirect_with_status
|
get :url_redirect_with_status
|
||||||
assert_response 301
|
assert_response 301
|
||||||
|
|
Loading…
Reference in a new issue