diff options
author | Taishi Kasuga <kasuga@livesense.co.jp> | 2015-04-09 11:21:00 +0900 |
---|---|---|
committer | Taishi Kasuga <kasuga@livesense.co.jp> | 2015-04-09 11:21:00 +0900 |
commit | 242c5c7ae4b9dbc1558ee9d673335f2b1e209188 (patch) | |
tree | 916fb131882ef6bee18ef1cdfe30c4d268ae9a27 /actionpack/test/controller/force_ssl_test.rb | |
parent | 8c8e9b34d576d2b223345d9073aca28c7975ecd7 (diff) | |
download | rails-242c5c7ae4b9dbc1558ee9d673335f2b1e209188.tar.gz rails-242c5c7ae4b9dbc1558ee9d673335f2b1e209188.tar.bz2 rails-242c5c7ae4b9dbc1558ee9d673335f2b1e209188.zip |
fix fails to force_ssl_redirection if session_store is disabled
Diffstat (limited to 'actionpack/test/controller/force_ssl_test.rb')
-rw-r--r-- | actionpack/test/controller/force_ssl_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/actionpack/test/controller/force_ssl_test.rb b/actionpack/test/controller/force_ssl_test.rb index 04222745d9..a1bb1cee58 100644 --- a/actionpack/test/controller/force_ssl_test.rb +++ b/actionpack/test/controller/force_ssl_test.rb @@ -321,4 +321,29 @@ class RedirectToSSLTest < ActionController::TestCase assert_response 200 assert_equal 'ihaz', response.body end + + def test_banana_redirects_to_https_if_not_https_and_flash_middleware_is_disabled + disable_flash + get :banana + assert_response 301 + assert_equal 'https://test.host/redirect_to_ssl/banana', redirect_to_url + ensure + enable_flash + end + + private + + def disable_flash + ActionDispatch::TestRequest.class_eval do + alias_method :flash_origin, :flash + undef_method :flash + end + end + + def enable_flash + ActionDispatch::TestRequest.class_eval do + alias_method :flash, :flash_origin + undef_method :flash_origin + end + end end |