From 8366cabd652a5fbb56fc0942614fbc965e7e45ed Mon Sep 17 00:00:00 2001 From: David Lee Date: Mon, 9 May 2011 16:17:38 -0700 Subject: Test csrf token param name customization --- railties/test/application/configuration_test.rb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'railties/test/application/configuration_test.rb') diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 6193e72625..43876c0a72 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -225,8 +225,6 @@ module ApplicationTests make_basic_app class ::OmgController < ActionController::Base - protect_from_forgery - def index render :inline => "<%= csrf_meta_tags %>" end @@ -236,6 +234,21 @@ module ApplicationTests assert last_response.body =~ /csrf\-param/ end + test "request forgery token param can be changed" do + make_basic_app do + app.config.action_controller.request_forgery_protection_token = '_xsrf_token_here' + end + + class ::OmgController < ActionController::Base + def index + render :inline => "<%= csrf_meta_tags %>" + end + end + + get "/" + assert last_response.body =~ /_xsrf_token_here/ + end + test "config.action_controller.perform_caching = true" do make_basic_app do |app| app.config.action_controller.perform_caching = true -- cgit v1.2.3