aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/request_forgery_protection_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-11-17 23:36:48 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2009-11-17 23:40:06 -0800
commite1385be025263fad6d339010d42fe553d1de64af (patch)
tree9e514c2c2a0ad77e4b857ee3d52cfbcdc796f802 /actionpack/test/controller/request_forgery_protection_test.rb
parentea290e77e6c50b13a0c9000eceaa5412de6918bc (diff)
downloadrails-e1385be025263fad6d339010d42fe553d1de64af.tar.gz
rails-e1385be025263fad6d339010d42fe553d1de64af.tar.bz2
rails-e1385be025263fad6d339010d42fe553d1de64af.zip
Extract form_authenticity_param instance method so it's overridable in subclasses
Diffstat (limited to 'actionpack/test/controller/request_forgery_protection_test.rb')
-rw-r--r--actionpack/test/controller/request_forgery_protection_test.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb
index 7111796f8d..3e54ae96c5 100644
--- a/actionpack/test/controller/request_forgery_protection_test.rb
+++ b/actionpack/test/controller/request_forgery_protection_test.rb
@@ -18,7 +18,7 @@ module RequestForgeryProtectionActions
def unsafe
render :text => 'pwn'
end
-
+
def rescue_action(e) raise e end
end
@@ -40,6 +40,13 @@ class FreeCookieController < RequestForgeryProtectionController
end
end
+class CustomAuthenticityParamController < RequestForgeryProtectionController
+ def form_authenticity_param
+ 'foobar'
+ end
+end
+
+
# common test methods
module RequestForgeryProtectionTests
@@ -241,3 +248,14 @@ class FreeCookieControllerTest < ActionController::TestCase
end
end
end
+
+class CustomAuthenticityParamControllerTest < ActionController::TestCase
+ def setup
+ ActionController::Base.request_forgery_protection_token = :authenticity_tok
+ end
+
+ def test_should_allow_custom_token
+ post :index, :authenticity_token => 'foobar'
+ assert_response :ok
+ end
+end