diff options
author | José Valim <jose.valim@gmail.com> | 2012-01-12 11:47:59 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-01-12 11:47:59 -0800 |
commit | ef1dfb62d7becb14c3905f1b86f811f2fd8721d6 (patch) | |
tree | 66757ac9ca78008ac6dfbb50697f71c51169d6d8 /actionpack/test/controller | |
parent | 488c9ef64c6717b48963a4c26ccf4fc888149da3 (diff) | |
parent | 321dae5dccded1eff6587582c8f0e0b88ca8303c (diff) | |
download | rails-ef1dfb62d7becb14c3905f1b86f811f2fd8721d6.tar.gz rails-ef1dfb62d7becb14c3905f1b86f811f2fd8721d6.tar.bz2 rails-ef1dfb62d7becb14c3905f1b86f811f2fd8721d6.zip |
Merge pull request #4429 from marcinbunsch/1923-force-ssl-redirect-keep-flash
When force redirecting to SSL, make sure that the session is kept
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/force_ssl_test.rb | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/actionpack/test/controller/force_ssl_test.rb b/actionpack/test/controller/force_ssl_test.rb index 43b20fdead..125012631e 100644 --- a/actionpack/test/controller/force_ssl_test.rb +++ b/actionpack/test/controller/force_ssl_test.rb @@ -26,6 +26,23 @@ class ForceSSLExceptAction < ForceSSLController force_ssl :except => :banana end +class ForceSSLFlash < ForceSSLController + force_ssl :except => [:banana, :set_flash, :use_flash] + + def set_flash + flash["that"] = "hello" + redirect_to '/force_ssl_flash/cheeseburger' + end + + def use_flash + @flash_copy = {}.update flash + @flashy = flash["that"] + render :inline => "hello" + end + +end + + class ForceSSLControllerLevelTest < ActionController::TestCase tests ForceSSLControllerLevel @@ -50,7 +67,7 @@ class ForceSSLCustomDomainTest < ActionController::TestCase assert_response 301 assert_equal "https://secure.test.host/force_ssl_custom_domain/banana", redirect_to_url end - + def test_cheeseburger_redirects_to_https_with_custom_host get :cheeseburger assert_response 301 @@ -101,3 +118,22 @@ class ForceSSLExcludeDevelopmentTest < ActionController::TestCase assert_response 200 end end + +class ForceSSLFlashTest < ActionController::TestCase + tests ForceSSLFlash + + def test_cheeseburger_redirects_to_https + get :set_flash + assert_response 302 + assert_equal "http://test.host/force_ssl_flash/cheeseburger", redirect_to_url + + get :cheeseburger + assert_response 301 + assert_equal "https://test.host/force_ssl_flash/cheeseburger", redirect_to_url + + get :use_flash + assert_equal "hello", assigns["flash_copy"]["that"] + assert_equal "hello", assigns["flashy"] + end + +end |