aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorChad Jolly <cjolly@lawgical.com>2011-09-14 15:50:56 -0600
committerChad Jolly <cjolly@lawgical.com>2012-01-18 19:42:31 +0100
commit7ce85e210eae680bc1c0400e37a0855e9eec03a2 (patch)
treec4163fd40c7e19830473f07a8415eb82a90287f2 /actionpack/test
parentb70236cfcb569c4560330b46f5c5ce76593e3225 (diff)
downloadrails-7ce85e210eae680bc1c0400e37a0855e9eec03a2.tar.gz
rails-7ce85e210eae680bc1c0400e37a0855e9eec03a2.tar.bz2
rails-7ce85e210eae680bc1c0400e37a0855e9eec03a2.zip
Exclude rack.request.form_vars from request.filtered_env
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/integration_test.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index a328372cff..99e1dc7966 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -535,3 +535,36 @@ class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
assert_equal old_env, env
end
end
+
+class EnvironmentFilterIntegrationTest < ActionDispatch::IntegrationTest
+ class TestController < ActionController::Base
+ def post
+ render :text => "Created", :status => 201
+ end
+ end
+
+ def self.call(env)
+ env["action_dispatch.parameter_filter"] = [:password]
+ routes.call(env)
+ end
+
+ def self.routes
+ @routes ||= ActionDispatch::Routing::RouteSet.new
+ end
+
+ routes.draw do
+ match '/post', :to => 'environment_filter_integration_test/test#post', :via => :post
+ end
+
+ def app
+ self.class
+ end
+
+ test "filters rack request form vars" do
+ post "/post", :username => 'cjolly', :password => 'secret'
+
+ assert_equal 'cjolly', request.filtered_parameters['username']
+ assert_equal '[FILTERED]', request.filtered_parameters['password']
+ assert_equal '[FILTERED]', request.filtered_env['rack.request.form_vars']
+ end
+end