From 242c5c7ae4b9dbc1558ee9d673335f2b1e209188 Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Thu, 9 Apr 2015 11:21:00 +0900 Subject: fix fails to force_ssl_redirection if session_store is disabled --- actionpack/test/controller/force_ssl_test.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'actionpack/test/controller') 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 -- cgit v1.2.3