aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/force_ssl_test.rb
diff options
context:
space:
mode:
authorBen Scheirman <ben@scheirman.com>2011-10-08 18:38:02 -0500
committerBen Scheirman <ben@scheirman.com>2011-10-08 18:38:02 -0500
commitd68f27e9b184a8e7e4ce71db11874a6b36ea1edc (patch)
tree6fd5706cf5780adceb2b392b1d24bdea767a237e /actionpack/test/controller/force_ssl_test.rb
parentf655895e87c8e013caac649986510eff4d3b03d9 (diff)
downloadrails-d68f27e9b184a8e7e4ce71db11874a6b36ea1edc.tar.gz
rails-d68f27e9b184a8e7e4ce71db11874a6b36ea1edc.tar.bz2
rails-d68f27e9b184a8e7e4ce71db11874a6b36ea1edc.zip
accept optional :host parameter to force_ssl
Diffstat (limited to 'actionpack/test/controller/force_ssl_test.rb')
-rw-r--r--actionpack/test/controller/force_ssl_test.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/actionpack/test/controller/force_ssl_test.rb b/actionpack/test/controller/force_ssl_test.rb
index 3e723e20d9..43b20fdead 100644
--- a/actionpack/test/controller/force_ssl_test.rb
+++ b/actionpack/test/controller/force_ssl_test.rb
@@ -14,6 +14,10 @@ class ForceSSLControllerLevel < ForceSSLController
force_ssl
end
+class ForceSSLCustomDomain < ForceSSLController
+ force_ssl :host => "secure.test.host"
+end
+
class ForceSSLOnlyAction < ForceSSLController
force_ssl :only => :cheeseburger
end
@@ -38,6 +42,22 @@ class ForceSSLControllerLevelTest < ActionController::TestCase
end
end
+class ForceSSLCustomDomainTest < ActionController::TestCase
+ tests ForceSSLCustomDomain
+
+ def test_banana_redirects_to_https_with_custom_host
+ get :banana
+ 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
+ assert_equal "https://secure.test.host/force_ssl_custom_domain/cheeseburger", redirect_to_url
+ end
+end
+
class ForceSSLOnlyActionTest < ActionController::TestCase
tests ForceSSLOnlyAction
@@ -80,4 +100,4 @@ class ForceSSLExcludeDevelopmentTest < ActionController::TestCase
get :banana
assert_response 200
end
-end \ No newline at end of file
+end