From 90815302ea2c7f798cb92e6bcf40be9277e28105 Mon Sep 17 00:00:00 2001 From: Russell Osborne Date: Thu, 1 Jun 2017 20:54:17 -0400 Subject: [PATCH] Add basic test to verify the positive context of filtering params --- .../spec/controllers/articles_controller_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_app/spec/controllers/articles_controller_spec.rb b/tests/test_app/spec/controllers/articles_controller_spec.rb index ab35124..2cf6c02 100644 --- a/tests/test_app/spec/controllers/articles_controller_spec.rb +++ b/tests/test_app/spec/controllers/articles_controller_spec.rb @@ -71,4 +71,20 @@ describe ArticlesController do Impression.last.session_hash.size.should eq 32 Impression.last.referrer.should eq nil end + + describe "when filtering params" do + before do + @_filtered_params = Rails.application.config.filter_parameters + Rails.application.config.filter_parameters = [:password] + end + + it "should FILTER params that are included in filtering {}" do + get "index", password: "best-password-ever" + Impression.last.params.should eq("password" => "[FILTERED]") + end + + after do + Rails.application.config.filter_parameters = @_filtered_params + end + end end