diff options
author | Alexey Vakhov <vakhov@gmail.com> | 2012-04-01 09:44:49 +0400 |
---|---|---|
committer | Alexey Vakhov <vakhov@gmail.com> | 2012-04-01 09:44:49 +0400 |
commit | 7f6bb2d86dd2fcf6d97ad8eb0e3e3032e2e602d6 (patch) | |
tree | d88386a768fc1bab566ab490d4a3f7435991dc86 | |
parent | 0244c0d8f339385a9b420a0565b17d327bf25b13 (diff) | |
download | rails-7f6bb2d86dd2fcf6d97ad8eb0e3e3032e2e602d6.tar.gz rails-7f6bb2d86dd2fcf6d97ad8eb0e3e3032e2e602d6.tar.bz2 rails-7f6bb2d86dd2fcf6d97ad8eb0e3e3032e2e602d6.zip |
Tests :if option of force_ssl method
-rw-r--r-- | actionpack/test/controller/force_ssl_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/controller/force_ssl_test.rb b/actionpack/test/controller/force_ssl_test.rb index 7feeda25b3..5b423c8151 100644 --- a/actionpack/test/controller/force_ssl_test.rb +++ b/actionpack/test/controller/force_ssl_test.rb @@ -26,6 +26,14 @@ class ForceSSLExceptAction < ForceSSLController force_ssl :except => :banana end +class ForceSSLIfCondition < ForceSSLController + force_ssl :if => :use_force_ssl? + + def use_force_ssl? + action_name == 'cheeseburger' + end +end + class ForceSSLFlash < ForceSSLController force_ssl :except => [:banana, :set_flash, :use_flash] @@ -109,6 +117,21 @@ class ForceSSLExceptActionTest < ActionController::TestCase end end +class ForceSSLIfConditionTest < ActionController::TestCase + tests ForceSSLIfCondition + + def test_banana_not_redirects_to_https + get :banana + assert_response 200 + end + + def test_cheeseburger_redirects_to_https + get :cheeseburger + assert_response 301 + assert_equal "https://test.host/force_ssl_if_condition/cheeseburger", redirect_to_url + end +end + class ForceSSLFlashTest < ActionController::TestCase tests ForceSSLFlash |