Skip to content

Commit

Permalink
Add test ensuring redirect_to uses the given protocol [#2886]
Browse files Browse the repository at this point in the history
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
Dan Croak authored and lifo committed Aug 8, 2009
1 parent 6464d76 commit 00544c7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions actionpack/test/controller/redirect_test.rb
Expand Up @@ -34,6 +34,10 @@ def redirect_with_status_hash
redirect_to({:action => "hello_world"}, {:status => 301})
end

def redirect_with_protocol
redirect_to :action => "hello_world", :protocol => "https"
end

def url_redirect_with_status
redirect_to("http://www.example.com", :status => :moved_permanently)
end
Expand Down Expand Up @@ -132,6 +136,12 @@ def test_redirect_with_status_hash
assert_equal "http://test.host/redirect/hello_world", redirect_to_url
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
get :url_redirect_with_status
assert_response 301
Expand Down

0 comments on commit 00544c7

Please sign in to comment.