aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/request_forgery_protection_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-11-23 22:04:18 -0200
committerJosé Valim <jose.valim@gmail.com>2009-11-23 22:04:18 -0200
commit4ff66b6b85d1351e447f18c027f1dba6bcf23a7b (patch)
treea46d6c65c5c67964bc8658bf991157f0f8056f55 /actionpack/test/controller/request_forgery_protection_test.rb
parent01ae99c681d31803f3a29f8305c9a041aa456660 (diff)
parent934bb012ba3f1da5cd181ae5c2d84f697a3c58a1 (diff)
downloadrails-4ff66b6b85d1351e447f18c027f1dba6bcf23a7b.tar.gz
rails-4ff66b6b85d1351e447f18c027f1dba6bcf23a7b.tar.bz2
rails-4ff66b6b85d1351e447f18c027f1dba6bcf23a7b.zip
Merge branch 'master' of git://github.com/rails/rails
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..09003adf73 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_token
+ end
+
+ def test_should_allow_custom_token
+ post :index, :authenticity_token => 'foobar'
+ assert_response :ok
+ end
+end