diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2010-08-19 15:29:54 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-20 10:40:34 -0300 |
commit | 0d0fbf1e648606c9499e332bad412da005a4e37f (patch) | |
tree | c6448eaf8d844c27b102b11009172784767d4588 /actionpack/test/dispatch/routing_test.rb | |
parent | 771d2f918fc87bdd4f83e6666fd816e9f0dcedfb (diff) | |
download | rails-0d0fbf1e648606c9499e332bad412da005a4e37f.tar.gz rails-0d0fbf1e648606c9499e332bad412da005a4e37f.tar.bz2 rails-0d0fbf1e648606c9499e332bad412da005a4e37f.zip |
Don't add the standard https port when using redirect in routes.rb and ensure that request.scheme returns https when using a reverse proxy.
[#5408 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 739b892c78..44b83f3afc 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -45,6 +45,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest match 'account/logout' => redirect("/logout"), :as => :logout_redirect match 'account/login', :to => redirect("/login") + match 'secure', :to => redirect("/secure/login") constraints(lambda { |req| true }) do match 'account/overview' @@ -2003,11 +2004,28 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_redirect_https + with_test_routes do + with_https do + get '/secure' + verify_redirect 'https://www.example.com/secure/login' + end + end + end + private def with_test_routes yield end + def with_https + old_https = https? + https! + yield + ensure + https!(old_https) + end + def verify_redirect(url, status=301) assert_equal status, @response.status assert_equal url, @response.headers['Location'] |